phpBMS

Changeset 170

Show
Ignore:
Timestamp:
11/10/06 19:49:30 (6 years ago)
Author:
brieb
Message:

Implements #20. Needs heavy testing on install/update and trying different security options.

Location:
trunk/phpbms
Files:
9 added
1 removed
81 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/common/stylesheet/mozilla/forms.css

    r162 r170  
    101101.buttonX{background:url(image/button-x.png) 0 0 no-repeat;} 
    102102.buttonTimeStamp{background:url(image/button-timestamp.png) 100% 0 no-repeat;padding-right:20px;font-size:11px;margin-right:6px;color:black;width:auto;} 
     103.buttonDownload{background:url(image/button-download.png) 0 0 no-repeat;} 
    103104 
    104105.buttonShowSQLUp{width:35px;background:url(image/button-sql-up.png) 0 0 no-repeat;} 
  • trunk/phpbms/common/stylesheet/mozilla/pages/tabledefs.css

    r160 r170  
    66#fsAttributes{float:right;width:200px;} 
    77#id,ds-moduleid{width:98%} 
     8#type{width:98%} 
    89 
    910#leftSideDiv{margin-right:228px;padding-top:1px;} 
  • trunk/phpbms/common/stylesheet/mozilla/pages/users.css

    r151 r170  
    99#leftSideDiv{margin-right:228px;padding-top:1px;} 
    1010#firstnameP{float:left;} 
     11 
     12#assignedrolesdiv{float:left; padding-right:10px;} 
     13#assignedroles,#availableroles{width:150px;} 
     14 
     15#rolebuttonsdiv{float:left;padding-top:20px;;padding-right:10px;} 
     16#rolebuttonsdiv button{width:100px;} 
     17 
     18#availablerolesdiv{} 
  • trunk/phpbms/include/common_functions.php

    r166 r170  
    4646                header("Location: ".$url); 
    4747        exit; 
     48} 
     49 
     50function hasRights($roleid){ 
     51        $hasrights=false; 
     52        if($_SESSION["userinfo"]["admin"]==1) 
     53                $hasrights=true; 
     54        elseif($roleid==0) 
     55                $hasrights=true; 
     56        else 
     57                foreach($_SESSION["userinfo"]["roles"] as $role) 
     58                        if($role==$roleid) 
     59                                $hasrights=true; 
     60 
     61        return $hasrights; 
     62} 
     63 
     64function displayRights($roleid,$rolename,$dblink=false){ 
     65                switch($roleid){ 
     66                        case 0: 
     67                                echo "EVERYONE"; 
     68                        break; 
     69                        case -100: 
     70                                echo "Administrators"; 
     71                        break; 
     72                        default: 
     73                                if(!$rolename){ 
     74                                        if(!$dblink) 
     75                                                reportError(400,"displayRights needs a database link if rolename is not specified"); 
     76                                        $querystatement="SELECT name FROM roles WHERE id=".$roleid; 
     77                                        $queryresult=mysql_query($querystatement,$dblink); 
     78                                        if(!queryresult) reportError(400,"displayRights could not retrieve role name"); 
     79                                        $therecord=mysql_fetch_array($queryresult); 
     80                                        $rolename=$therecord["name"]; 
     81                                } 
     82                                echo $rolename; 
     83                } 
    4884} 
    4985 
     
    296332                break; 
    297333                case "filelink": 
    298                         $value="<a href=\"".$_SESSION["app_path"]."servefile.php?i=".$value."\" style=\"display:block;\"><img src=\"".$_SESSION["app_path"]."common/stylesheet/".$_SESSION["stylesheet"]."/image/button-download.png\" align=\"middle\" alt=\"view\" width=\"16\" height=\"16\" border=\"0\" /></a>"; 
     334                        $value="<button class=\"graphicButtons buttonDownload\" type=\"button\" onclick=\"document.location='".$_SESSION["app_path"]."servefile.php?i=".$value."'\"><span>download</span></button>"; 
     335                        //$value="<a href=\"".$_SESSION["app_path"]."servefile.php?i=".$value."\" style=\"display:block;\"><img src=\"".$_SESSION["app_path"]."common/stylesheet/".$_SESSION["stylesheet"]."/image/button-download.png\" align=\"middle\" alt=\"view\" width=\"16\" height=\"16\" border=\"0\" /></a>"; 
    299336                break; 
    300337                case "noencoding": 
  • trunk/phpbms/include/fields.php

    r161 r170  
    332332        }//end required if 
    333333}//end function 
     334 
     335function roles_choicelist($name,$selected,$dblink){ 
     336        $querystatement="SELECT name,id FROM roles WHERE inactive=0"; 
     337        $queryresult=mysql_query($querystatement,$dblink); 
     338        if(!$queryresult) reportError(310,"Error Retrieving Roles"); 
     339        ?><select id="<?php echo $name?>" name="<?php echo $name?>"> 
     340        <option value="0" <?php if($selected==0) echo "selected"?>>EVERYONE</option> 
     341        <?php while($therecord=mysql_fetch_array($queryresult)){ ?> 
     342        <option value="<?php echo $therecord["id"]?>" <?php if($selected==$therecord["id"]) echo "selected"?>><?php echo $therecord["name"]?></option>   
     343        <?php }?> 
     344        <option value="-100" <?php if($selected==-100) echo "selected"?>>Administrators</option> 
     345        </select><?php 
     346} 
    334347?> 
  • trunk/phpbms/include/login_include.php

    r166 r170  
    4040                $thereturn="Login Failed"; 
    4141                 
    42                 $querystatement="SELECT id, firstname, lastname, accesslevel, email, phone, department, employeenumber  
     42                $querystatement="SELECT id, firstname, lastname, email, phone, department, employeenumber, admin 
    4343                                                FROM users  
    44                                                 WHERE login=\"".$username."\" and password=ENCODE(\"".$password."\",\"".$seed."\") and revoked=0 and accesslevel>=10"; 
     44                                                WHERE login=\"".$username."\" and password=ENCODE(\"".$password."\",\"".$seed."\") and revoked=0 and portalaccess=0"; 
    4545                $queryresult=mysql_query($querystatement,$dblink); 
    46                 if(!$queryresult) 
    47                         reportError(300,"Error verifing user record"); 
     46                if(!$queryresult) reportError(300,"Error verifing user record: ".$querystatement); 
    4847                if(mysql_num_rows($queryresult)){ 
    4948                        //We found a record that matches in the database 
    5049                        // populate the session and go in 
    5150                        $_SESSION["userinfo"]=mysql_fetch_array($queryresult); 
     51                         
     52                        // Next get the users roles, and populate the session with them 
     53                        $_SESSION["userinfo"]["roles"][]=0; 
     54                        $querystatement="SELECT roleid FROM rolestousers WHERE userid=".$_SESSION["userinfo"]["id"]; 
     55                        $rolesqueryresult=mysql_query($querystatement,$dblink); 
     56                        if(!$rolesqueryresult) reportError(310,"Error obtaining user roles."); 
     57                        while($rolerecord=mysql_fetch_array($rolesqueryresult)) 
     58                                $_SESSION["userinfo"]["roles"][]=$rolerecord["roleid"]; 
    5259                         
    5360                        // set application location (web, not physical) 
  • trunk/phpbms/include/print_class.php

    r166 r170  
    6060                        $this->maintable=$therecord["maintable"]; 
    6161 
     62 
     63                        $securitywhere=""; 
     64                        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0) 
     65                                $securitywhere=" AND roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)"; 
    6266                        $querystatement="SELECT id,name,reportfile,type,description,displayorder FROM reports  
    63                                                         WHERE (tabledefid=0 or tabledefid=".$this->tableid.") and accesslevel <= ".$_SESSION["userinfo"]["accesslevel"]." ORDER BY tabledefid desc, displayorder desc,name"; 
     67                                                        WHERE (tabledefid=0 or tabledefid=".$this->tableid.") ".$securitywhere." ORDER BY tabledefid desc, displayorder desc,name"; 
    6468                        $queryresult=mysql_query($querystatement,$dblink);               
    6569                        if(!$queryresult) reportError(500,"Error retreving reports."); 
     
    8084                        global $dblink; 
    8185                         
    82                         $querystring="SELECT id,name,userid FROM usersearches WHERE tabledefid=".$this->tableid." and type=\"".$type."\" and((userid=0 and accesslevel<=".$_SESSION["userinfo"]["accesslevel"].") or userid=\"".$userid."\") order by userid,name"; 
     86                        $securitywhere=""; 
     87                        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0) 
     88                                $securitywhere=" AND roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)"; 
     89                        $querystring="SELECT id,name,userid FROM usersearches WHERE tabledefid=".$this->tableid." and type=\"".$type."\" and((userid=0 ".$securitywhere.") or userid=\"".$userid."\") order by userid,name"; 
    8390                        $thequery = mysql_query($querystring,$dblink); 
    8491                        return $thequery; 
  • trunk/phpbms/include/search_class.php

    r155 r170  
    5555                        $querystatement="SELECT tabledefs.id,maintable,querytable,tabledefs.displayname,addfile,editfile,deletebutton,type, 
    5656                                                          defaultwhereclause,defaultsortorder,defaultsearchtype,defaultcriteriafindoptions,defaultcriteriaselection, 
    57                                                           modules.name 
     57                                                          modules.name,searchroleid,advsearchroleid,viewsqlroleid 
    5858                                                          FROM tabledefs inner join modules on tabledefs.moduleid=modules.id 
    5959                                                          WHERE tabledefs.id=".$id; 
     
    6565                         
    6666                        $therecord=mysql_fetch_array($queryresult); 
     67                         
     68                        if(!hasRights($therecord["searchroleid"])) 
     69                                goURL($_SESSION["app_path"]."noaccess.php"); 
    6770                         
    6871                        return $therecord; 
     
    9598<th nowrap align="<?php echo $therow["align"]?>" <?php if($therow["size"]) echo "width=\"".$therow["size"]."\" ";?> > 
    9699        <input name="sortit<?php echo $i?>" type="hidden" value="<?php echo $therow["name"]?>" /> 
    97         <a href="/" onClick="doSort(<?php echo $i?>);return false;"><?php echo $therow["name"]?></a> 
     100        <a href="/" onclick="doSort(<?php echo $i?>);return false;"><?php echo $therow["name"]?></a> 
    98101        <?php 
    99102                // If sorting on this column give the option to reverse the sort order. 
    100103                if ($this->querysortorder==$therow["column"] || $this->querysortorder==$therow["sortorder"])  
    101         {?>&nbsp;<a href="/" onClick="doDescSort();return false;"><img src="<?php echo $_SESSION["app_path"]?>common/image/down_arrow.gif" alt="dn" title="dn" width="10" height="10" border="0" /></a><input name="desc" type="hidden" value="" /> 
     104        {?>&nbsp;<a href="/" onclick="doDescSort();return false;"><img src="<?php echo $_SESSION["app_path"]?>common/image/down_arrow.gif" alt="dn" title="dn" width="10" height="10" border="0" /></a><input name="desc" type="hidden" value="" /> 
    102105<?php } elseif ($this->querysortorder==$therow["column"]." DESC" || $this->querysortorder==$therow["sortorder"]." DESC")  
    103 {?> &nbsp;<a href="/" onClick="doSort(<?php echo $i?>);return false;"><img src="<?php echo $_SESSION["app_path"]?>common/image/up_arrow.gif" alt="up" title="up" width="10" height="10" border="0" /></a> 
     106{?> &nbsp;<a href="/" onclick="doSort(<?php echo $i?>);return false;"><img src="<?php echo $_SESSION["app_path"]?>common/image/up_arrow.gif" alt="up" title="up" width="10" height="10" border="0" /></a> 
    104107<?php } ?></th><?php 
    105108                $i++; 
     
    337340                 
    338341                        $options=Array(); 
    339                         $querystatement="SELECT name,`option`,othercommand,accesslevel 
     342                        $querystatement="SELECT name,`option`,othercommand,roleid 
    340343                                                                  FROM tableoptions WHERE tabledefid=".$id; 
    341344                        $queryresult=mysql_query($querystatement,$dblink); 
     
    345348                                if($therecord["othercommand"]) { 
    346349                                        $options["othercommands"][$therecord["name"]]["displayname"]=$therecord["option"]; 
    347                                         $options["othercommands"][$therecord["name"]]["accesslevel"]=$therecord["accesslevel"]; 
     350                                        $options["othercommands"][$therecord["name"]]["roleid"]=$therecord["roleid"]; 
    348351                                }else{ 
    349352                                        $options[$therecord["name"]]["allowed"]=$therecord["option"]; 
    350                                         $options[$therecord["name"]]["accesslevel"]=$therecord["accesslevel"]; 
     353                                        $options[$therecord["name"]]["roleid"]=$therecord["roleid"]; 
    351354                                } 
    352355                        } 
     
    358361                         
    359362                        $findoptions=Array(); 
    360                         $querystatement="SELECT name,search,accesslevel 
     363                        $querystatement="SELECT name,search,roleid 
    361364                                                                  FROM tablefindoptions WHERE tabledefid=".$id." ORDER BY displayorder"; 
    362365                        $queryresult=mysql_query($querystatement,$dblink); 
     
    402405<ul class="tabs"> 
    403406        <li id="basicSearchT" class="tabsSel"><a href="/" onClick="switchSearchTabs(this);return false">basic</a></li> 
    404         <?php if($_SESSION["userinfo"]["accesslevel"]>=30){?><li id="advancedSearchT"><a href="/" onClick="switchSearchTabs(this,'<?php echo $_SESSION["app_path"]?>');return false">advanced</a></li><?php } //end accesslevel ?> 
     407        <?php if(hasRights($this->thetabledef["advsearchroleid"])){?><li id="advancedSearchT"><a href="/" onClick="switchSearchTabs(this,'<?php echo $_SESSION["app_path"]?>');return false">advanced</a></li><?php } //end access ?> 
    405408        <li id="loadSearchT"><a href="/" onClick="switchSearchTabs(this,'<?php echo $_SESSION["app_path"]?>');return false">load search</a></li> 
    406409        <li id="saveSearchT"><a href="/" onClick="switchSearchTabs(this,'<?php echo $_SESSION["app_path"]?>');return false">save search</a></li> 
     
    417420                                                <?php                                                                                    
    418421                                                        for($i=0;$i<count($this->findoptions);$i++) { 
    419                                                                 if($this->findoptions[$i]["accesslevel"]<=$_SESSION["userinfo"]["accesslevel"]){ 
     422                                                                if(hasRights($this->findoptions[$i]["roleid"])){ 
    420423                                                                        ?><option value="<?php echo $this->findoptions[$i]["name"]?>"<?php  
    421424                                                                                if($this->querytype=="search" and $this->findoptions[$i]["name"]==$this->savedfindoptions) echo "selected"; 
     
    469472                </tr>                            
    470473        </table> 
    471 </div><?php if($_SESSION["userinfo"]["accesslevel"]>=30){?><div id="advancedSearchTab" style="display:none;"></div><?php } //end accesslevel ?> 
     474</div><?php if(hasRights($this->thetabledef["advsearchroleid"])){?><div id="advancedSearchTab" style="display:none;"></div><?php } //end access ?> 
    472475<div id="loadSearchTab" style="display:none;padding:0px;margin:0px;"></div> 
    473476<div id="saveSearchTab" style="display:none;margin:0px;padding:0px;margin:0px;"> 
     
    494497        if(!isset($this->tableoptions["new"])){ 
    495498                 $this->tableoptions["new"]["allowed"]=0; 
    496                  $this->tableoptions["new"]["accesslevel"]=0; 
     499                 $this->tableoptions["new"]["roleid"]=0; 
    497500        } 
    498501        if(!isset($this->tableoptions["select"])) { 
    499502                $this->tableoptions["select"]["allowed"]=0; 
    500                 $this->tableoptions["select"]["accesslevel"]=0; 
     503                $this->tableoptions["select"]["roleid"]=0; 
    501504        } 
    502505        if(!isset($this->tableoptions["edit"])){ 
    503506                 $this->tableoptions["edit"]["allowed"]=0; 
    504                  $this->tableoptions["edit"]["accesslvel"]=0; 
     507                 $this->tableoptions["edit"]["roleid"]=0; 
    505508        } 
    506509        if(!isset($this->tableoptions["printex"])) { 
    507510                $this->tableoptions["printex"]["allowed"]=0; 
    508                 $this->tableoptions["printex"]["accesslevel"]=0; 
     511                $this->tableoptions["printex"]["roleid"]=0; 
    509512        } 
    510513        if(!isset($this->tableoptions["othercommands"])) $this->tableoptions["othercommands"]=false; 
    511         if($_SESSION["userinfo"]["accesslevel"]>=90){?> 
     514        if(hasRights($this->thetabledef["viewsqlroleid"])){?> 
    512515        <div id="sqlstatement"> 
    513516        <fieldset> 
     
    546549                <div id="recordCommands"> 
    547550                <?php  
    548                 if ($this->tableoptions["new"]["allowed"] && $_SESSION["userinfo"]["accesslevel"]>=$this->tableoptions["new"]["accesslevel"])  
     551                if ($this->tableoptions["new"]["allowed"] && hasRights($this->tableoptions["new"]["roleid"]))  
    549552                        { 
    550553                ?><button type="button" accesskey="n" class="graphicButtons buttonNew" onClick="addRecord()" title="new (alt+n)"><span>new</span></button><?php  
     
    552555                         
    553556                if($this->numrows) { 
    554                         if ($this->tableoptions["edit"]["allowed"] && $_SESSION["userinfo"]["accesslevel"]>=$this->tableoptions["edit"]["accesslevel"]) { 
     557                        if ($this->tableoptions["edit"]["allowed"] && hasRights($this->tableoptions["edit"]["roleid"])) { 
    555558                                ?><button id="edit" accesskey="e" type="button" disabled="true" class="graphicButtons buttonEditDisabled" onClick="editThis()" title="edit (alt+e)"><span>edit</span></button><?php 
    556559                        } 
    557560                 
    558                         if($this->tableoptions["printex"]["allowed"] && $_SESSION["userinfo"]["accesslevel"]>=$this->tableoptions["printex"]["accesslevel"]){ 
     561                        if($this->tableoptions["printex"]["allowed"] && hasRights($this->tableoptions["printex"]["roleid"])){ 
    559562                                ?><button id="print" accesskey="p" type="submit" disabled="true" class="graphicButtons buttonPrintDisabled" name="doprint"  title="print (alt+p)"><span>print</span></button><?php 
    560563                        } 
     
    572575                                if($this->tableoptions["othercommands"]){ 
    573576                                        foreach($this->tableoptions["othercommands"] as $key => $value){ 
    574                                                 if($_SESSION["userinfo"]["accesslevel"]>=$value["accesslevel"]){ 
     577                                                if(hasRights($value["roleid"])){ 
    575578                                                        ?><option value="<?php echo $key?>"><?php echo $value["displayname"]?></option><?php 
    576579                                                } 
     
    579582                                ?></select><?php 
    580583                } 
    581                 if($this->tableoptions["select"]["allowed"] && $_SESSION["userinfo"]["accesslevel"]>=$this->tableoptions["select"]["accesslevel"]){?> <select id="searchSelection" onChange="perfromToSelection(this)"> 
     584                if($this->tableoptions["select"]["allowed"] && hasRights($this->tableoptions["select"]["roleid"])){?> <select id="searchSelection" onChange="perfromToSelection(this)"> 
    582585                                <option class="choiceListBlank" value="">selection...</option> 
    583586                                <option value="">_____________</option> 
     
    590593                 
    591594                }//end if numrows        
    592                 if($_SESSION["userinfo"]["accesslevel"]>=90){?><button id="showSQLButton" type="button" class="graphicButtons buttonShowSQLDown"><span>Show SQL</span></button><?php }//end accesslevel?> 
     595                if(hasRights($this->thetabledef["viewsqlroleid"])){?><button id="showSQLButton" type="button" class="graphicButtons buttonShowSQLDown"><span>Show SQL</span></button><?php }//end rights?> 
    593596                </div><script language="JavaScript" type="text/javascript"> 
    594597        var addFile="<?php echo $_SESSION["app_path"].$this->thetabledef["addfile"]?>"; 
  • trunk/phpbms/include/session.php

    r169 r170  
    133133        if (!isset($_SESSION["userinfo"]) && basename($_SERVER["PHP_SELF"]) != "index.php") { 
    134134                if(isset($loginNoKick)){ 
    135                         if(!isset($loginNoDisplayError)){ 
    136                                 header("Location: ".$mainpath."noaccess.html"); 
     135                        if(!isset($loginNoDisplayError)) 
    137136                                exit(); 
    138                         } 
    139137                        else 
    140138                                $dblink = openDB($_SESSION["mysql_server"],$_SESSION["mysql_user"],$_SESSION["mysql_userpass"],$_SESSION["mysql_database"]);  
  • trunk/phpbms/install/ updatev0.7.sql

    r154 r170  
    1313ALTER TABLE tablecolumns CHANGE COLUMN `format` `format` enum('date','time','currency','boolean','datetime','filelink','noencoding') default NULL; 
    1414UPDATE tablecolumns SET format="noencoding" WHERE `column` like "%<%"; 
    15 UPDATE tablecolumns SET name="inherent" WHERE id=93;  
     15UPDATE tablecolumns SET name="inherent" WHERE id=93; 
     16ALTER TABLE users ADD COLUMN admin tinyint(4) NOT NULL DEFAULT 0; 
     17ALTER TABLE users ADD COLUMN portalaccess tinyint(4) NOT NULL DEFAULT 0; 
     18CREATE TABLE `roles` (`id` INTEGER UNSIGNED DEFAULT NULL AUTO_INCREMENT, `name` VARCHAR(64) NOT NULL,`description` TEXT,`inactive` tinyint(4) NOT NULL,`createdby` INTEGER UNSIGNED,`creationdate` DATETIME,`modifiedby` INTEGER UNSIGNED,`modifieddate` TIMESTAMP,PRIMARY KEY(`id`))TYPE = MyISAM; 
     19INSERT INTO `roles` (`id`,`name`,`description`,`inactive`,`createdby`,`creationdate`,`modifiedby`) VALUES (10,'shipping','Basic user access only.',0,1,NOW(),1); 
     20INSERT INTO `roles` (`id`,`name`,`description`,`inactive`,`createdby`,`creationdate`,`modifiedby`) VALUES (20,'sales','Power User.',0,1,NOW(),1); 
     21INSERT INTO `roles` (`id`,`name`,`description`,`inactive`,`createdby`,`creationdate`,`modifiedby`) VALUES (30,'sales manager','',0,1,NOW(),1); 
     22INSERT INTO `roles` (`id`,`name`,`description`,`inactive`,`createdby`,`creationdate`,`modifiedby`) VALUES (50,'upper manager','',0,1,NOW(),1); 
     23CREATE TABLE `rolestousers` (`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `userid` INTEGER UNSIGNED NOT NULL, `roleid` INTEGER UNSIGNED NOT NULL, PRIMARY KEY(`id`)) TYPE = MYISAM; 
     24UPDATE users SET admin=1 WHERE accesslevel>=90; 
     25UPDATE users SET portalaccess=1 WHERE accesslevel<0; 
     26UPDATE users set accesslevel=0 WHERE  accesslevel<0 or accesslevel>=90; 
     27ALTER TABLE menu CHANGE accesslevel roleid int(11) NOT NULL default '0'; 
     28UPDATE tablecolumns SET name='access', `column`='if(menu.roleid=0,\'EVERYONE\',if(menu.roleid=-100,\'Administrators\',roles.name))',sortorder='' WHERE id=88; 
     29UPDATE tabledefs SET querytable="((menu LEFT JOIN menu as parentmenu on menu.parentid=parentmenu.id) LEFT JOIN roles on menu.roleid=roles.id)" WHERE id=19; 
     30UPDATE menu SET roleid=0 WHERE roleid<0; 
     31UPDATE menu SET roleid=-100 WHERE roleid>=90; 
     32UPDATE menu SET roleid=-100 WHERE parentid=15; 
     33UPDATE menu SET roleid=0 WHERE parentid=14 or id=14; 
     34ALTER TABLE tabledefs ADD COLUMN searchroleid int(11) NOT NULL DEFAULT 0; 
     35ALTER TABLE tabledefs ADD COLUMN addroleid int(11) NOT NULL DEFAULT 0; 
     36ALTER TABLE tabledefs ADD COLUMN editroleid int(11) NOT NULL DEFAULT 0; 
     37ALTER TABLE tabledefs ADD COLUMN advsearchroleid int(11) NOT NULL DEFAULT -100; 
     38ALTER TABLE tabledefs ADD COLUMN viewsqlroleid int(11) NOT NULL DEFAULT -100; 
     39UPDATE tabledefs set searchroleid=-100,addroleid=-100,editroleid=-100 WHERE moduleid=1 AND id IN(21,26,19,10,11,9,200,17); 
     40UPDATE tableoptions set accesslevel=0 WHERE accesslevel <0; 
     41UPDATE tableoptions set accesslevel=-100 WHERE accesslevel >=90; 
     42ALTER TABLE tableoptions CHANGE accesslevel roleid int(11) NOT NULL default '0'; 
     43UPDATE tablefindoptions set accesslevel=0 WHERE accesslevel <0; 
     44UPDATE tablefindoptions set accesslevel=0 WHERE accesslevel =11; 
     45UPDATE tablefindoptions set accesslevel=-100 WHERE accesslevel >=90; 
     46ALTER TABLE tablefindoptions CHANGE accesslevel roleid int(11) NOT NULL default '0'; 
     47UPDATE files set accesslevel=0 WHERE accesslevel <0; 
     48UPDATE files set accesslevel=-100 WHERE accesslevel >=90; 
     49ALTER TABLE files CHANGE accesslevel roleid int(11) NOT NULL default '0'; 
     50UPDATE usersearches set accesslevel=0 WHERE accesslevel <0; 
     51UPDATE usersearches set accesslevel=-100 WHERE accesslevel >=90; 
     52ALTER TABLE usersearches CHANGE accesslevel roleid int(11) NOT NULL default '0'; 
     53UPDATE reports set accesslevel=0 WHERE accesslevel <0; 
     54UPDATE reports set accesslevel=-100 WHERE accesslevel >=90; 
     55ALTER TABLE reports CHANGE accesslevel roleid int(11) NOT NULL default '0'; 
     56ALTER TABLE `phpbms`.`users` DROP COLUMN `accesslevel`; 
  • trunk/phpbms/install/choices.sql

    r145 r170  
    1 INSERT INTO choices VALUES (105,'department','management'); 
    2 INSERT INTO choices VALUES (104,'department','accounting'); 
    3 INSERT INTO choices VALUES (103,'department',''); 
    4 INSERT INTO choices VALUES (130,'notestatus','cancelled'); 
    5 INSERT INTO choices VALUES (131,'notestatus','tenative'); 
    6 INSERT INTO choices VALUES (132,'notestatus','confirmed'); 
    7 INSERT INTO choices VALUES (129,'notestatus',''); 
     1INSERT INTO choices VALUES (1,'department','management'); 
     2INSERT INTO choices VALUES (2,'department','accounting'); 
     3INSERT INTO choices VALUES (3,'department',''); 
     4INSERT INTO choices VALUES (4,'notestatus','cancelled'); 
     5INSERT INTO choices VALUES (5,'notestatus','tenative'); 
     6INSERT INTO choices VALUES (6,'notestatus','confirmed'); 
     7INSERT INTO choices VALUES (7,'notestatus',''); 
  • trunk/phpbms/install/createtables.sql

    r146 r170  
    1616  creationdate datetime NOT NULL default '0000-00-00 00:00:00', 
    1717  modifieddate timestamp(14) NOT NULL, 
    18   accesslevel int(11) NOT NULL default '0', 
     18  roleid int(11) NOT NULL default '0', 
    1919  PRIMARY KEY  (id) 
    2020) TYPE=MyISAM; 
     
    8181) TYPE=MyISAM PACK_KEYS=0; 
    8282 
    83 CREATE TABLE reports ( 
    84   description text, 
    85   id int(11) NOT NULL auto_increment, 
    86   name varchar(64) default NULL, 
    87   reportfile varchar(128) default NULL, 
    88   type varchar(32) default NULL, 
    89   createdby int(11) NOT NULL default '0', 
    90   creationdate datetime NOT NULL default '0000-00-00 00:00:00', 
    91   modifiedby int(11) default NULL, 
    92   modifieddate timestamp(14) NOT NULL, 
    93   tabledefid int(11) NOT NULL default '0', 
    94   displayorder int(11) NOT NULL default '0', 
    95   accesslevel int(11) NOT NULL default '0', 
    96   UNIQUE KEY theid (id) 
    97 ) TYPE=MyISAM PACK_KEYS=0; 
    98  
     83CREATE TABLE `reports` ( 
     84  `id` int(11) NOT NULL auto_increment, 
     85  `name` varchar(64) default NULL, 
     86  `type` varchar(32) default NULL, 
     87  `tabledefid` int(11) NOT NULL default '0', 
     88  `displayorder` int(11) NOT NULL default '0', 
     89  `roleid` int(11) NOT NULL default '0', 
     90  `reportfile` varchar(128) default NULL, 
     91  `description` text, 
     92  `createdby` int(11) NOT NULL default '0', 
     93  `creationdate` datetime NOT NULL default '0000-00-00 00:00:00', 
     94  `modifiedby` int(11) default NULL, 
     95  `modifieddate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, 
     96  PRIMARY KEY  (`id`) 
     97) ENGINE=MyISAM 
    9998 
    10099CREATE TABLE `tablecolumns` ( 
     
    115114) TYPE=MyISAM AUTO_INCREMENT=5000; 
    116115 
    117 CREATE TABLE `tabledefs` (   
    118 `editfile` varchar(128) default NULL,   
    119 `displayname` varchar(64) default NULL,   
    120 `id` int(11) NOT NULL auto_increment,   
    121 `maintable` varchar(64) NOT NULL default '',   
    122 `createdby` int(11) NOT NULL default '0',   
    123 `creationdate` datetime NOT NULL default '0000-00-00 00:00:00',   
    124 `modifiedby` int(11) default NULL,   
    125 `modifieddate` timestamp(14) NOT NULL,   
    126 `querytable` varchar(255) NOT NULL default '',   
    127 `addfile` varchar(100) default '',   
    128 `deletebutton` varchar(32) default '',   
    129 `defaultwhereclause` varchar(255) default NULL,   
    130 `defaultsortorder` varchar(255) default '',   
    131 `defaultsearchtype` varchar(64) default '',   
    132 `defaultcriteriafindoptions` varchar(128) default '',   
    133 `defaultcriteriaselection` varchar(128) default '',   
    134 `type` varchar(16) NOT NULL default 'table',   
    135 `moduleid` int(11) NOT NULL default '0',   
    136 PRIMARY KEY (`id`)   
    137 ) TYPE=MyISAM AUTO_INCREMENT=1000;  
     116CREATE TABLE `tabledefs` ( 
     117  `id` int(11) NOT NULL, 
     118  `displayname` varchar(64) default NULL, 
     119  `type` varchar(16) NOT NULL default 'table', 
     120  `moduleid` int(11) NOT NULL default '0', 
     121  `maintable` varchar(64) NOT NULL default '', 
     122  `querytable` varchar(255) NOT NULL default '', 
     123  `editfile` varchar(128) default NULL, 
     124  `editroleid` int(11) NOT NULL default '0', 
     125  `addfile` varchar(100) default '', 
     126  `addroleid` int(11) NOT NULL default '0', 
     127  `searchroleid` int(11) NOT NULL default '0', 
     128  `advsearchroleid` int(11) NOT NULL default '-100', 
     129  `viewsqlroleid` int(11) NOT NULL default '-100', 
     130  `deletebutton` varchar(32) default '', 
     131  `defaultwhereclause` varchar(255) default NULL, 
     132  `defaultsortorder` varchar(255) default '', 
     133  `defaultsearchtype` varchar(64) default '', 
     134  `defaultcriteriafindoptions` varchar(128) default '', 
     135  `defaultcriteriaselection` varchar(128) default '', 
     136  `createdby` int(11) NOT NULL default '0', 
     137  `creationdate` datetime NOT NULL default '0000-00-00 00:00:00', 
     138  `modifiedby` int(11) default NULL, 
     139  `modifieddate` timestamp NOT NULL default CURRENT_TIMESTAMP, 
     140  PRIMARY KEY  (`id`) 
     141) ENGINE=MyISAM AUTO_INCREMENT=1000;  
    138142 
    139143CREATE TABLE tablefindoptions ( 
     
    143147  search varchar(255) NOT NULL default '', 
    144148  displayorder int(11) NOT NULL default '0', 
    145   accesslevel int(11) NOT NULL default '0', 
     149  roleid int(11) NOT NULL default '0', 
    146150  PRIMARY KEY  (id), 
    147151  KEY tabledef (tabledefid) 
     
    154158  `option` varchar(128) NOT NULL default '', 
    155159  othercommand tinyint(1) NOT NULL default '0', 
    156   accesslevel int(11) NOT NULL default '0', 
     160  roleid int(11) NOT NULL default '0', 
    157161  PRIMARY KEY  (id), 
    158162  KEY tabledef (tabledefid) 
     
    177181  creationdate datetime NOT NULL default '0000-00-00 00:00:00', 
    178182  revoked tinyint(1) NOT NULL default '0', 
    179   accesslevel int(11) default '1', 
    180183  createdby int(11) NOT NULL default '0', 
    181184  modifiedby int(11) default '0', 
     
    197200  sqlclause text, 
    198201  type char(3) NOT NULL default 'SCH', 
    199   accesslevel int(11) NOT NULL default '0', 
     202  roleid int(11) NOT NULL default '0', 
    200203  PRIMARY KEY  (id), 
    201204  KEY tabledefid (tabledefid), 
     
    221224  `modifiedby` int(11) default '0', 
    222225  `modifieddate` timestamp(14) NOT NULL, 
    223   `accesslevel` int(11) NOT NULL default '0', 
     226  `roleid` int(11) NOT NULL default '0', 
    224227  PRIMARY KEY  (`id`) 
    225228) TYPE=MyISAM AUTO_INCREMENT=100;  
     
    239242  KEY `thefile` (`fileid`) 
    240243) TYPE=MyISAM;  
     244 
     245CREATE TABLE `roles` ( 
     246  `id` INTEGER UNSIGNED DEFAULT NULL AUTO_INCREMENT, 
     247  `name` VARCHAR(64) NOT NULL, 
     248  `description` TEXT, 
     249  `inactive` tinyint(4) NOT NULL, 
     250  `createdby` INTEGER UNSIGNED, 
     251  `creationdate` DATETIME, 
     252  `modifiedby` INTEGER UNSIGNED, 
     253  `modifieddate` TIMESTAMP, 
     254  PRIMARY KEY(`id`) 
     255) TYPE = MyISAM; 
     256 
     257CREATE TABLE `rolestousers` ( 
     258  `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, 
     259  `userid` INTEGER UNSIGNED NOT NULL, 
     260  `roleid` INTEGER UNSIGNED NOT NULL, 
     261  PRIMARY KEY(`id`) 
     262) TYPE = MYISAM; 
  • trunk/phpbms/install/installxml.php

    r145 r170  
    172172                                        $thereturn.=importData("settings"); 
    173173                                        $thereturn.=importData("files"); 
     174                                        $thereturn.=importData("roles"); 
    174175                                        $thereturn.="\nDone Importing Data\n===========================\n"; 
    175176                         
  • trunk/phpbms/install/menu.sql

    r145 r170  
    1 INSERT INTO menu VALUES (14,'Organizer','',0,3,2,2,'2004-04-08 14:30:58',20051012120012,10); 
    2 INSERT INTO menu VALUES (15,'Admin','',0,4,2,2,'2004-04-08 14:31:36',20050209120312,90); 
    3 INSERT INTO menu VALUES (16,'Notes','search.php?id=12',14,1,2,2,'2005-09-09 10:09:50',20051012120012,10); 
    4 INSERT INTO menu VALUES (17,'Tasks','search.php?id=23',14,2,2,2,'2005-09-09 10:10:08',20051012120012,10); 
    5 INSERT INTO menu VALUES (18,'Events','search.php?id=24',14,3,2,2,'2005-09-09 10:10:40',20051012120012,10); 
    6 INSERT INTO menu VALUES (19,'Snapshot','modules/base/snapshot.php',14,0,2,2,'2005-09-16 12:19:17',20051012120012,10); 
    7 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('settings','modules/base/adminsettings.php',15,10,2,2,'2006-10-16 05:19:30','2006-10-19 21:32:14',90); 
    8 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('modules','search.php?id=21',15,99,2,2,'2006-10-16 05:20:31','2006-10-19 21:32:53',90); 
    9 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('menu','search.php?id=19',15,30,2,2,'2006-10-16 05:21:14','2006-10-19 21:33:14',90); 
    10 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('table definitions','search.php?id=11',15,80,2,2,'2006-10-16 05:21:59','2006-10-19 21:33:59',90); 
    11 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('files','search.php?id=26',15,30,2,2,'2006-10-16 05:22:31','2006-10-19 21:34:08',90); 
    12 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('users','search.php?id=9',15,20,2,2,'2006-10-16 05:23:27','2006-10-19 21:32:36',90); 
    13 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('----','N/A',15,15,2,2,'2006-10-19 15:26:58','2006-10-19 21:33:32',90); 
    14 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('reports','search.php?id=16',15,50,2,2,'2006-10-19 15:42:58','2006-10-19 21:43:19',-90); 
    15 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('relationships','search.php?id=10',15,60,2,2,'2006-10-19 15:44:10','2006-10-19 21:44:10',90); 
    16 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('Saved Searchs/Sorts','search.php?id=17',15,40,2,2,'2006-10-19 15:44:54','2006-10-19 21:44:54',90); 
    17 INSERT INTO `menu` (name,link,parentid,displayorder,createdby,modifiedby,creationdate,modifieddate,accesslevel) VALUES ('----','N/A',15,45,2,2,'2006-10-19 15:45:18','2006-10-19 21:45:18',90); 
     1INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (1,'Organizer','',0,3,1,1,NOW(),NOW(),0); 
     2INSERT 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); 
     3INSERT 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); 
     4INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (4,'Events','search.php?id=24',1,3,1,1,NOW(),NOW(),0); 
     5INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (5,'Snapshot','modules/base/snapshot.php',1,0,1,1,NOW(),NOW(),0); 
     6INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (6,'Admin','',0,4,1,1,NOW(),NOW(),-100); 
     7INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (7,'settings','modules/base/adminsettings.php',6,10,1,1,NOW(),NOW(),-100); 
     8INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (8,'----','N/A',6,11,1,1,NOW(),NOW(),-100); 
     9INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (9,'users','search.php?id=9',6,20,1,1,NOW(),NOW(),-100); 
     10INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (10,'roles','search.php?id=200',6,21,1,1,NOW(),NOW(),-100); 
     11INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (11,'----','',6,22,1,1,NOW(),NOW(),-100); 
     12INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (12,'menu','search.php?id=19',6,30,1,1,NOW(),NOW(),-100); 
     13INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (13,'files','search.php?id=26',6,30,1,1,NOW(),NOW(),-100); 
     14INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (14,'Saved Searchs/Sorts','search.php?id=17',6,40,1,1,NOW(),NOW(),-100); 
     15INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (15,'----','N/A',6,45,1,1,NOW(),NOW(),-100); 
     16INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (16,'reports','search.php?id=16',6,50,1,1,NOW(),NOW(),-100); 
     17INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (17,'relationships','search.php?id=10',6,60,1,1,NOW(),NOW(),-100); 
     18INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (18,'table definitions','search.php?id=11',6,80,1,1,NOW(),NOW(),-100); 
     19INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (19,'modules','search.php?id=21',6,99,1,1,NOW(),NOW(),-100); 
  • trunk/phpbms/install/reports.sql

    r145 r170  
    1 INSERT INTO reports VALUES ('This report will prints out of every field for the table for the given records.  The report is displayed HTML format.',4,'Raw Table Print','report/general_tableprint.php','report',2,'2003-01-28 12:15:01',2,20051021180104,0,0,30); 
    2 INSERT INTO reports VALUES ('This report will generate a tab-delimited text file. Values are encapsulated in quotes, and the first line lists the field names.',5,'Raw Table Export','report/general_export.php','export',2,'2003-01-28 18:10:35',2,20051021180057,0,0,30); 
    3 INSERT INTO reports VALUES ('PDF report giving basic note information (subject,dates,content) .  By deault, the notes are shown in chronological order.',19,'Note Summary','modules/base/report/notes_summary.php','PDF Report',18,'2005-03-30 16:41:39',2,20050401143706,12,50,0); 
     1INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (1,'Raw Table Print','report',0,0,30,'report/general_tableprint.php','This report will prints out of every field for the table for the given records.  The report is displayed HTML format.',1,NOW(),1,NOW()); 
     2INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (2,'Raw Table Export','export',0,0,30,'report/general_export.php','This report will generate a tab-delimited text file. Values are encapsulated in quotes, and the first line lists the field names.',1,NOW(),1,NOW()); 
     3INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (3,'Note Summary','PDF Report',12,50,0,'modules/base/report/notes_summary.php','PDF report giving basic note information (subject,dates,content) .  By deault, the notes are shown in chronological order.',1,NOW(),1,NOW()); 
  • trunk/phpbms/install/tablecolumns.sql

    r154 r170  
    1 INSERT INTO tablecolumns VALUES (100,9,'log in name','users.login','left','',2,'',0,'',NULL); 
    2 INSERT INTO tablecolumns VALUES (3,9,'id','users.id','left','',0,'',0,'',NULL); 
    3 INSERT INTO tablecolumns VALUES (5,9,'name','concat(users.firstname,\" \",users.lastname)','left','',1,'',0,'100%',NULL); 
    4 INSERT INTO tablecolumns VALUES (6,9,'last login','users.lastlogin','left','',4,'',0,'','datetime'); 
    5 INSERT INTO tablecolumns VALUES (7,9,'revoked','users.revoked','center','',3,'',0,'','boolean'); 
    6 INSERT INTO tablecolumns VALUES (20,10,'name','relationships.name','left','',3,'',0,'100%',NULL); 
    7 INSERT INTO tablecolumns VALUES (92,10,'to field','relationships.tofield','left','',5,'',0,'',NULL); 
    8 INSERT INTO tablecolumns VALUES (91,10,'from field','relationships.fromfield','left','',2,'',0,'',NULL); 
    9 INSERT INTO tablecolumns VALUES (90,10,'to table','totable.displayname','left','',4,'',0,'',NULL); 
    10 INSERT INTO tablecolumns VALUES (89,10,'from table','fromtable.displayname','left','',1,'',0,'',NULL); 
    11 INSERT INTO tablecolumns VALUES (93,10,'inherent','relationships.inherint','center','',6,'',0,'','boolean'); 
    12 INSERT INTO tablecolumns VALUES (19,10,'id','relationships.id','center','',0,'',0,'',NULL); 
    13 INSERT INTO tablecolumns VALUES (8,11,'id','tabledefs.id','center','',0,'',0,'',NULL); 
    14 INSERT INTO tablecolumns VALUES (9,11,'main table','tabledefs.maintable','left','',4,'',0,'100%',NULL); 
    15 INSERT INTO tablecolumns VALUES (10,11,'display','concat(\"<strong>\",tabledefs.displayname,\"</strong>\")','left','',3,'tabledefs.displayname',0,'','noencoding'); 
    16 INSERT INTO tablecolumns VALUES (43,11,'type','tabledefs.type','center','',2,'',0,'',NULL); 
    17 INSERT INTO tablecolumns VALUES (96,11,'module','modules.name','left','',1,'',0,'',NULL); 
    18 INSERT INTO tablecolumns VALUES (121,12,'category','notes.category','left','',3,'',0,'',NULL); 
    19 INSERT INTO tablecolumns VALUES (120,12,'done','notes.completed','center','',5,'',0,'','boolean'); 
    20 INSERT INTO tablecolumns VALUES (131,12,'type','concat(\"<B>\",notes.type,\"</B>\")','center','',2,'',0,'','noencoding'); 
    21 INSERT INTO tablecolumns VALUES (39,12,'title','notes.subject','left','',4,'',1,'90%',NULL); 
    22 INSERT INTO tablecolumns VALUES (34,12,'id','notes.id','center','',0,'',0,'',NULL); 
    23 INSERT INTO tablecolumns VALUES (119,12,'!','ELT(notes.importance+3,\"&nbsp;\",\"&middot;\",\"-\",\"*\",\"!\",\"<b style=\'color:blue\'>!</b>\")','center','',1,'notes.importance',0,'','noencoding'); 
    24 INSERT INTO tablecolumns VALUES (26,16,'id','reports.id','center','',0,'',0,'',NULL); 
    25 INSERT INTO tablecolumns VALUES (28,16,'name','concat(\"<strong>\",reports.name,\"</strong>\")','left','reports.name',2,'',0,'','noencoding'); 
    26 INSERT INTO tablecolumns VALUES (29,16,'type','reports.type','left','',4,'',0,'100%',NULL); 
    27 INSERT INTO tablecolumns VALUES (111,16,'order','reports.displayorder','center','',3,'',0,'',NULL); 
    28 INSERT INTO tablecolumns VALUES (94,16,'table','if(tabledefs.displayname is null,\"<b>global</b>\",tabledefs.displayname)','left','',1,'',0,'','noencoding'); 
    29 INSERT INTO tablecolumns VALUES (30,17,'id','usersearches.id','center','',0,'',0,'',NULL); 
    30 INSERT INTO tablecolumns VALUES (31,17,'name','usersearches.name','left','',1,'',0,'100%',NULL); 
    31 INSERT INTO tablecolumns VALUES (32,17,'user','if(usersearches.userid=0,\"<b>global</b>\",concat(users.lastname,\", \",users.firstname))','left','',2,'',0,'','noencoding'); 
    32 INSERT INTO tablecolumns VALUES (33,17,'table','tabledefs.maintable','left','',4,'',0,'',NULL); 
    33 INSERT INTO tablecolumns VALUES (101,17,'type','if(usersearches.type=\"SCH\",\"Search\",\"Sort\")','left','',3,'usersearches.type',0,'',NULL); 
    34 INSERT INTO tablecolumns VALUES (82,19,'id','menu.id','center','',0,'',0,'',NULL); 
    35 INSERT INTO tablecolumns VALUES (84,19,'link','menu.link','left','',2,'',1,'',NULL); 
    36 INSERT INTO tablecolumns VALUES (88,19,'access level','concat(\" \",menu.accesslevel)','center','',3,'menu.accesslevel',0,'',NULL); 
    37 INSERT INTO tablecolumns VALUES (86,19,'Item','concat(if(parentmenu.name is null,\"\",concat(parentmenu.name,\" :: \")),menu.name)','left','',1,'',0,'100%',NULL); 
    38 INSERT INTO tablecolumns VALUES (95,21,'id','modules.id','center','',0,'',0,'',NULL); 
    39 INSERT INTO tablecolumns VALUES (97,21,'name','modules.displayname','left','',1,'',1,'100%',NULL); 
    40 INSERT INTO tablecolumns VALUES (98,21,'version','modules.version','left','',2,'',0,'',NULL); 
    41 INSERT INTO tablecolumns VALUES (122,23,'!','ELT(notes.importance+3,\" \",\"·\",\"-\",\"*\",\"!\",\"<b style=\'color:blue\'>!</b>\")','center','',1,'notes.importance',0,'','noencoding'); 
    42 INSERT INTO tablecolumns VALUES (123,23,'category','notes.category','left','',4,'',0,'',NULL); 
    43 INSERT INTO tablecolumns VALUES (115,24,'id','notes.id','left','',0,'',0,'',NULL); 
    44 INSERT INTO tablecolumns VALUES (116,24,'start','if(notes.starttime,concat(notes.startdate,\" \",notes.starttime),notes.startdate)','left','',2,'concat(notes.startdate,\" \",notes.starttime)',0,'','datetime'); 
    45 INSERT INTO tablecolumns VALUES (114,23,'complete','notes.completed','center','',2,'',0,'','boolean'); 
    46 INSERT INTO tablecolumns VALUES (112,23,'id','notes.id','left','',0,'',0,'',NULL); 
    47 INSERT INTO tablecolumns VALUES (113,23,'title','notes.subject','left','',5,'',1,'90%',NULL); 
    48 INSERT INTO tablecolumns VALUES (124,23,'repeat','notes.repeat+if(notes.parentid is null, 0,1)','center','',3,'',0,'','boolean'); 
    49 INSERT INTO tablecolumns VALUES (130,23,'due date','if(notes.endtime is not null,concat(notes.enddate,\" \",notes.endtime),notes.enddate)','left','',6,'',0,'','datetime'); 
    50 INSERT INTO tablecolumns VALUES (117,24,'end','if(notes.endtime,concat(notes.enddate,\" \",notes.endtime),notes.enddate)','left','',3,'concat(notes.enddate,\" \",notes.endtime)',0,'','datetime'); 
    51 INSERT INTO tablecolumns VALUES (118,24,'title','notes.subject','left','',5,'',1,'90%',NULL); 
    52 INSERT INTO tablecolumns VALUES (126,24,'status','notes.status','left','',6,'',0,'',NULL); 
    53 INSERT INTO tablecolumns VALUES (125,24,'!','ELT(notes.importance+3,\" \",\"·\",\"-\",\"*\",\"!\",\"<b style=\'color:blue\'>!</b>\")','center','',4,'',0,'','noencoding'); 
    54 INSERT INTO tablecolumns VALUES (127,24,'category','notes.category','left','',7,'',1,'',NULL); 
    55 INSERT INTO tablecolumns VALUES (128,24,'location','notes.category','left','',8,'',1,'',NULL); 
    56 INSERT INTO tablecolumns VALUES (129,24,'rpt.','notes.`repeat`','center','',1,'notes.repeat',0,'','boolean'); 
    57 INSERT INTO tablecolumns VALUES (141,26,'id','files.id','left','',0,'',0,'',NULL); 
    58 INSERT INTO tablecolumns VALUES (142,26,'description','files.description','left','',2,'',1,'99%',NULL); 
    59 INSERT INTO tablecolumns VALUES (144,26,'file','files.name','left','',1,'',0,'',NULL); 
    60 INSERT INTO tablecolumns VALUES (151,26,'download','files.id','center','',3,'',0,'','filelink'); 
    61 INSERT INTO tablecolumns VALUES (148,27,'attached','attachments.creationdate','left','',2,'',0,'','datetime'); 
    62 INSERT INTO tablecolumns VALUES (147,27,'file','concat(\"<b>\",files.name,\"</b>\")','left','',0,'files.name',0,'','noencoding'); 
    63 INSERT INTO tablecolumns VALUES (150,27,'download','files.id','center','',3,'',0,'','filelink'); 
    64 INSERT INTO tablecolumns VALUES (149,27,'description','files.description','left','',1,'',1,'100%',NULL); 
     1INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (100,9,'log in name','users.login','left','',2,'',0,'',NULL); 
     2INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (3,9,'id','users.id','left','',0,'',0,'',NULL); 
     3INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (5,9,'name','concat(users.firstname,\" \",users.lastname)','left','',1,'',0,'100%',NULL); 
     4INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (6,9,'last login','users.lastlogin','left','',4,'',0,'','datetime'); 
     5INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (7,9,'revoked','users.revoked','center','',3,'',0,'','boolean'); 
     6INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (20,10,'name','relationships.name','left','',3,'',0,'100%',NULL); 
     7INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (92,10,'to field','relationships.tofield','left','',5,'',0,'',NULL); 
     8INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (91,10,'from field','relationships.fromfield','left','',2,'',0,'',NULL); 
     9INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (90,10,'to table','totable.displayname','left','',4,'',0,'',NULL); 
     10INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (89,10,'from table','fromtable.displayname','left','',1,'',0,'',NULL); 
     11INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (93,10,'inherent','relationships.inherint','center','',6,'',0,'','boolean'); 
     12INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (19,10,'id','relationships.id','center','',0,'',0,'',NULL); 
     13INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (8,11,'id','tabledefs.id','center','',0,'',0,'',NULL); 
     14INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (9,11,'main table','tabledefs.maintable','left','',4,'',0,'100%',NULL); 
     15INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (10,11,'display','concat(\"<strong>\",tabledefs.displayname,\"</strong>\")','left','',3,NULL,0,'','noencoding'); 
     16INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (43,11,'type','tabledefs.type','center','',2,'',0,'',NULL); 
     17INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (96,11,'module','modules.name','left','',1,'',0,'',NULL); 
     18INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (121,12,'category','notes.category','left','',3,'',0,'',NULL); 
     19INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (120,12,'done','notes.completed','center','',5,'',0,'','boolean'); 
     20INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (131,12,'type','concat(\"<B>\",notes.type,\"</B>\")','center','',2,NULL,0,'','noencoding'); 
     21INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (39,12,'title','notes.subject','left','',4,'',1,'90%',NULL); 
     22INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (34,12,'id','notes.id','center','',0,'',0,'',NULL); 
     23INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (119,12,'!','ELT(notes.importance+3,\" \",\"·\",\"-\",\"*\",\"!\",\"<b style=\'color:blue\'>!</b>\")','center','',1,'notes.importance',0,'','noencoding'); 
     24INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (26,16,'id','reports.id','center','',0,'',0,'',NULL); 
     25INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (28,16,'name','concat(\"<strong>\",reports.name,\"</strong>\")','left','',2,'',0,'','noencoding'); 
     26INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (29,16,'type','reports.type','left','',4,'',0,'100%',NULL); 
     27INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (111,16,'order','reports.displayorder','center','',3,'',0,'',NULL); 
     28INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (94,16,'table','if(tabledefs.displayname is null,\"<b>global</b>\",tabledefs.displayname)','left','',1,NULL,0,'','noencoding'); 
     29INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (30,17,'id','usersearches.id','center','',0,'',0,'',NULL); 
     30INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (31,17,'name','usersearches.name','left','',1,'',0,'100%',NULL); 
     31INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (32,17,'user','if(usersearches.userid=0,\"<b>global</b>\",concat(users.lastname,\", \",users.firstname))','left','',2,NULL,0,'','noencoding'); 
     32INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (33,17,'table','tabledefs.maintable','left','',4,'',0,'',NULL); 
     33INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (101,17,'type','if(usersearches.type=\"SCH\",\"Search\",\"Sort\")','left','',3,'usersearches.type',0,'',NULL); 
     34INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (82,19,'id','menu.id','center','',0,'',0,'',NULL); 
     35INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (84,19,'link','menu.link','left','',2,'',1,'',NULL); 
     36INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (88,19,'access','if(menu.roleid=0,\'EVERYONE\',if(menu.roleid=-100,\'Administrators\',roles.name))','center','',3,'',0,'',NULL); 
     37INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (86,19,'Item','concat(if(parentmenu.name is null,\"\",concat(parentmenu.name,\" :: \")),menu.name)','left','',1,'',0,'100%',NULL); 
     38INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (95,21,'id','modules.id','center','',0,'',0,'',NULL); 
     39INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (97,21,'name','modules.displayname','left','',1,'',1,'100%',NULL); 
     40INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (98,21,'version','modules.version','left','',2,'',0,'',NULL); 
     41INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (122,23,'!','ELT(notes.importance+3,\" \",\"·\",\"-\",\"*\",\"!\",\"<b style=\'color:blue\'>!</b>\")','center','',1,NULL,0,'','noencoding'); 
     42INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (123,23,'category','notes.category','left','',4,'',0,'',NULL); 
     43INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (115,24,'id','notes.id','left','',0,'',0,'',NULL); 
     44INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (116,24,'start','if(notes.starttime,concat(notes.startdate,\" \",notes.starttime),notes.startdate)','left','',2,'concat(notes.startdate,\" \",notes.starttime)',0,'','datetime'); 
     45INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (114,23,'complete','notes.completed','center','',2,'',0,'','boolean'); 
     46INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (112,23,'id','notes.id','left','',0,'',0,'',NULL); 
     47INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (113,23,'title','notes.subject','left','',5,'',1,'90%',NULL); 
     48INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (124,23,'repeat','notes.repeat+if(notes.parentid is null, 0,1)','center','',3,'',0,'','boolean'); 
     49INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (130,23,'due date','if(notes.endtime is not null,concat(notes.enddate,\" \",notes.endtime),notes.enddate)','left','',6,'',0,'','datetime'); 
     50INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (117,24,'end','if(notes.endtime,concat(notes.enddate,\" \",notes.endtime),notes.enddate)','left','',3,'concat(notes.enddate,\" \",notes.endtime)',0,'','datetime'); 
     51INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (118,24,'title','notes.subject','left','',5,'',1,'90%',NULL); 
     52INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (126,24,'status','notes.status','left','',6,'',0,'',NULL); 
     53INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (125,24,'!','ELT(notes.importance+3,\" \",\"·\",\"-\",\"*\",\"!\",\"<b style=\'color:blue\'>!</b>\")','center','',4,NULL,0,'','noencoding'); 
     54INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (127,24,'category','notes.category','left','',7,'',1,'',NULL); 
     55INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (128,24,'location','notes.category','left','',8,'',1,'',NULL); 
     56INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (129,24,'rpt.','notes.`repeat`','center','',1,'notes.repeat',0,'','boolean'); 
     57INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (141,26,'id','files.id','left','',0,'',0,'',NULL); 
     58INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (142,26,'description','files.description','left','',2,'',1,'99%',NULL); 
     59INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (144,26,'file','files.name','left','',1,'',0,'',NULL); 
     60INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (151,26,'download','files.id','center','',3,'',0,'','filelink'); 
     61INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (148,27,'attached','attachments.creationdate','left','',2,'',0,'','datetime'); 
     62INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (147,27,'file','concat(\"<b>\",files.name,\"</b>\")','left','',0,NULL,0,'','noencoding'); 
     63INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (150,27,'download','files.id','center','',3,'',0,'','filelink'); 
     64INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (149,27,'description','files.description','left','',1,'',1,'100%',NULL); 
     65INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (5001,200,'name','roles.name','left','',1,'',0,'99%',NULL); 
     66INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (5002,200,'inactive','roles.inactive','center','',2,'',0,'','boolean'); 
     67INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (5000,200,'id','roles.id','left','',0,'',0,'',NULL); 
  • trunk/phpbms/install/tabledefs.sql

    r145 r170  
    1 INSERT INTO tabledefs VALUES ('modules/base/users_addedit.php','Users',9,'users',2,'2004-03-04 14:50:45',2,20040413102940,'users','modules/base/users_addedit.php','revoke','users.id !=0','users.id','','','','system',1); 
    2 INSERT INTO tabledefs VALUES ('modules/base/relationships_addedit.php','Relationships',10,'relationships',2,'2004-03-04 14:51:18',2,20040413102940,'(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','delete','relationships.id != 0','fromtable.displayname, name','','','','system',1); 
    3 INSERT INTO tabledefs VALUES ('modules/base/tabledefs_addedit.php','Table Definitions',11,'tabledefs',2,'2004-03-04 14:52:21',2,20051006143406,'tabledefs left join modules on tabledefs.moduleid=modules.id','modules/base/tabledefs_addedit.php','delete','tabledefs.id != 0','modules.name, tabledefs.displayname','','','','system',1); 
    4 INSERT INTO tabledefs VALUES ('modules/base/notes_addedit.php','Notes',12,'notes',2,'2004-03-04 14:54:49',2,20051021170130,'notes','modules/base/notes_addedit.php','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','table',1); 
    5 INSERT INTO tabledefs VALUES ('modules/base/notes_addedit.php?backurl=../../search.php?id=23','Tasks',23,'notes',2,'2005-09-15 17:25:10',2,20050928190020,'((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?ty=TS&backurl=../../search.php?id=23','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','','view',1); 
    6 INSERT INTO tabledefs VALUES ('modules/base/usersearches_edit.php','Saved Searches/Sorts',17,'usersearches',2,'2004-04-06 18:10:00',2,20050222114515,'(usersearches left join users on usersearches.userid = users.id) inner join tabledefs on usersearches.tabledefid=tabledefs.id','N/A','delete','usersearches.id != 0','usersearches.name','','','','system',1); 
    7 INSERT INTO tabledefs VALUES ('modules/base/reports_addedit.php','Reports',16,'reports',2,'2004-04-06 17:56:37',2,20051006112919,'reports left join tabledefs on reports.tabledefid=tabledefs.id','modules/base/reports_addedit.php','delete','reports.id != 0','tabledefid,displayorder DESC, reports.name','','','','system',1); 
    8 INSERT INTO tabledefs VALUES ('modules/base/menu_addedit.php','Menu',19,'menu',2,'2004-04-07 14:17:24',2,20040413102940,'(menu LEFT JOIN menu as parentmenu on menu.parentid=parentmenu.id)','modules/base/menu_addedit.php','delete','menu.id!=0','concat(if(parentmenu.name is null,\"\",concat(parentmenu.displayorder,\"-\")),menu.displayorder)','','','','system',1); 
    9 INSERT INTO tabledefs VALUES ('modules/base/modules_view.php','Installed Modules',21,'modules',2,'2004-04-12 14:29:21',2,20040413102940,'modules','modules/base/modules_view.php','NA','modules.id!=0','modules.name','','','','system',1); 
    10 INSERT INTO tabledefs VALUES ('modules/base/notes_addedit.php?backurl=../../search.php?id=24','Events',24,'notes',2,'2005-09-20 15:27:29',2,20051116162057,'((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?ty=EV&backurl=../../search.php?id=24','delete','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)','notes.repeat DESC,notes.startdate DESC,notes.starttime DESC,notes.enddate DESC,notes.endtime DESC,notes.importance','search','','','view',1); 
    11 INSERT INTO tabledefs VALUES ('modules/base/files_addedit.php','Files',26,'files',2,'2005-11-17 21:44:07',2,20051117214436,'files','modules/base/files_addedit.php','delete','files.id=-1','files.name','search','','','table',1); 
    12 INSERT INTO tabledefs VALUES ('modules/base/files_addedit.php','Attachments',27,'attachments',2,'2005-11-22 11:38:15',2,20051122125549,'(attachments INNER JOIN files on attachments.fileid=files.id)','modules/base/files_addedit.php','delete','attachments.id!=0','attachments.creationdate DESC','search','','','table',1); 
     1INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (9,'Users','system',1,'users','users','modules/base/users_addedit.php',-100,'modules/base/users_addedit.php',-100,-100,-100,-100,'revoke','users.id !=0','users.id','','','',1,NOW(),1,NOW()); 
     2INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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',-100,'modules/base/relationships_addedit.php',-100,-100,-100,-100,'delete','relationships.id != 0','fromtable.displayname, name','','','',1,NOW(),1,NOW()); 
     3INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,-100,-100,-100,'delete','tabledefs.id != 0','modules.name, tabledefs.displayname','','','',1,NOW(),1,NOW()); 
     4INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (12,'Notes','table',1,'notes','notes','modules/base/notes_addedit.php',0,'modules/base/notes_addedit.php',0,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()); 
     5INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,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','',2,'2005-09-15 17:25:10',1,NOW(),1,NOW()); 
     6INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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',-100,'N/A',-100,-100,-100,-100,'delete','usersearches.id != 0','usersearches.name','','','',1,NOW(),1,NOW()); 
     7INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (16,'Reports','system',1,'reports','reports left join tabledefs on reports.tabledefid=tabledefs.id','modules/base/reports_addedit.php',-100,'modules/base/reports_addedit.php',-100,-100,-100,-100,'delete','reports.id != 0','tabledefid,displayorder DESC, reports.name','','','',2,'2004-04-06 17:56:37',1,NOW(),1,NOW()); 
     8INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,-100,-100,-100,'delete','menu.id!=0','concat(if(parentmenu.name is null,\"\",concat(parentmenu.displayorder,\"-\")),menu.displayorder)','','','',1,NOW(),1,NOW()); 
     9INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (21,'Installed Modules','system',1,'modules','modules','modules/base/modules_view.php',-100,'modules/base/modules_view.php',-100,-100,-100,-100,'NA','modules.id!=0','modules.name','','','',1,NOW(),1,NOW()); 
     10INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,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())) OR notes.`repeat`=1)','notes.repeat DESC,notes.startdate DESC,notes.starttime DESC,notes.enddate DESC,notes.endtime DESC,notes.importance','search','','',1,NOW(),1,NOW()); 
     11INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (26,'Files','table',1,'files','files','modules/base/files_addedit.php',-100,'modules/base/files_addedit.php',-100,-100,-100,-100,'delete','files.id=-1','files.name','search','','',1,NOW(),1,NOW()); 
     12INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,0,-100,-100,'delete','attachments.id!=0','attachments.creationdate DESC','search','','',1,NOW(),1,NOW()); 
     13INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (200,'Roles','table',1,'roles','roles','modules/base/roles_addedit.php',-100,'modules/base/roles_addedit.php',-100,-100,-100,-100,'inactivate','roles.id!=-1','name','search','','',1,NOW(),1,NOW()); 
     14 
     15INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (9,'Users','system',1,'users','users','modules/base/users_addedit.php',0,'modules/base/users_addedit.php',0,0,-100,-100,'revoke','users.id !=0','users.id','','','',1,NOW(),1,NOW()); 
     16INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,0,-100,-100,'delete','relationships.id != 0','fromtable.displayname, name','','','',1,NOW(),1,NOW()); 
     17INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,-100,-100,-100,'delete','tabledefs.id != 0','modules.name, tabledefs.displayname','','','',1,NOW(),1,NOW()); 
     18INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (12,'Notes','table',1,'notes','notes','modules/base/notes_addedit.php',0,'modules/base/notes_addedit.php',0,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()); 
     19INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,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()); 
     20INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,0,-100,-100,'delete','usersearches.id != 0','usersearches.name','','','',1,NOW(),1,NOW()); 
     21INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,0,-100,-100,'delete','reports.id != 0','tabledefid,displayorder DESC, reports.name','','','',1,NOW(),1,NOW()); 
     22INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,-100,-100,-100,'delete','menu.id!=0','concat(if(parentmenu.name is null,\"\",concat(parentmenu.displayorder,\"-\")),menu.displayorder)','','','',1,NOW(),1,NOW()); 
     23INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (21,'Installed Modules','system',1,'modules','modules','modules/base/modules_view.php',0,'modules/base/modules_view.php',0,0,-100,-100,'NA','modules.id!=0','modules.name','','','',1,NOW(),1,NOW()); 
     24INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,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())) OR notes.`repeat`=1)','notes.repeat DESC,notes.startdate DESC,notes.starttime DESC,notes.enddate DESC,notes.endtime DESC,notes.importance','search','','',1,NOW(),1,NOW()); 
     25INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (26,'Files','table',1,'files','files','modules/base/files_addedit.php',0,'modules/base/files_addedit.php',0,-100,-100,-100,'delete','files.id=-1','files.name','search','','',1,NOW(),1,NOW()); 
     26INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,0,-100,-100,'delete','attachments.id!=0','attachments.creationdate DESC','search','','',1,NOW(),1,NOW()); 
     27INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (200,'Roles','table',1,'roles','roles','modules/base/roles_addedit.php',-100,'modules/base/roles_addedit.php',-100,-100,-100,-100,'inactivate','roles.id!=-1','name','search','','',1,NOW(),1,NOW()); 
  • trunk/phpbms/install/tablefindoptions.sql

    r145 r170  
    1 INSERT INTO tablefindoptions VALUES (3,9,'All Users','users.id!=0',1,0); 
    2 INSERT INTO tablefindoptions VALUES (4,9,'Revoked Users','users.revoked=1',1,0); 
    3 INSERT INTO tablefindoptions VALUES (13,10,'All Records','relationships.id !=0',1,0); 
    4 INSERT INTO tablefindoptions VALUES (5,11,'All Records','tabledefs.id !=0',1,0); 
    5 INSERT INTO tablefindoptions 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 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 VALUES (20,12,'My Notes','notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',1,0); 
    8 INSERT INTO tablefindoptions 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 VALUES (14,16,'All Reports','reports.id != 0',1,0); 
    10 INSERT INTO tablefindoptions VALUES (15,17,'All Records','usersearches.id != 0',1,0); 
    11 INSERT INTO tablefindoptions VALUES (42,19,'All Records','menu.id!=0',1,0); 
    12 INSERT INTO tablefindoptions VALUES (43,21,'All Records','modules.id!=0',1,0); 
    13 INSERT INTO tablefindoptions VALUES (71,12,'System Messages','notes.type=\"SM\"',4,-10); 
    14 INSERT INTO tablefindoptions VALUES (72,12,'Public Notes','notes.type=\'NT\' AND notes.private=0',6,0); 
    15 INSERT INTO tablefindoptions VALUES (73,12,'My Unread Notes','notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0',0,0); 
    16 INSERT INTO tablefindoptions VALUES (74,12,'Public Unread Notes','notes.type=\'NT\' AND notes.private=0 AND notes.completed=0',5,0); 
    17 INSERT INTO tablefindoptions VALUES (76,23,'My Uncompleted Tasks','notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND completed=0',0,0); 
    18 INSERT INTO tablefindoptions VALUES (77,23,'My Tasks','notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',1,0); 
    19 INSERT INTO tablefindoptions 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 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 VALUES (80,23,'Public Uncomplete Tasks','notes.type=\'TS\' AND notes.private=0 AND notes.completed=0',4,0); 
    22 INSERT INTO tablefindoptions VALUES (81,23,'Public Tasks','notes.type=\'NT\' AND notes.private=0',5,0); 
    23 INSERT INTO tablefindoptions 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 VALUES (83,24,'My Events','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',0,0); 
    25 INSERT INTO tablefindoptions VALUES (84,24,'Public Events','notes.type=\'EV\' AND notes.private=0',8,0); 
    26 INSERT INTO tablefindoptions 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 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 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 VALUES (88,24,'My Events - Today','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}} AND ((notes.startdate = curdate()) OR notes.`repeat`=1)',1,-10); 
    30 INSERT INTO tablefindoptions 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,-10); 
    31 INSERT INTO tablefindoptions 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 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 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 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 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 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 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 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 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 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 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 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 VALUES (108,26,'All Records','files.id!=0',0,-10); 
     1INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (3,9,'All Users','users.id!=0',1,0); 
     2INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (4,9,'Revoked Users','users.revoked=1',1,0); 
     3INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (13,10,'All Records','relationships.id !=0',1,0); 
     4INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (5,11,'All Records','tabledefs.id !=0',1,0); 
     5INSERT 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); 
     6INSERT 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); 
     7INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (20,12,'My Notes','notes.type=\'NT\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',1,0); 
     8INSERT 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); 
     9INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (14,16,'All Reports','reports.id != 0',1,0); 
     10INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (15,17,'All Records','usersearches.id != 0',1,0); 
     11INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (42,19,'All Records','menu.id!=0',1,0); 
     12INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (43,21,'All Records','modules.id!=0',1,0); 
     13INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (71,12,'System Messages','notes.type=\"SM\"',4,0); 
     14INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (72,12,'Public Notes','notes.type=\'NT\' AND notes.private=0',6,0); 
     15INSERT 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); 
     16INSERT 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); 
     17INSERT 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); 
     18INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (77,23,'My Tasks','notes.type=\'TS\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',1,0); 
     19INSERT 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); 
     20INSERT 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); 
     21INSERT 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); 
     22INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (81,23,'Public Tasks','notes.type=\'NT\' AND notes.private=0',5,0); 
     23INSERT 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); 
     24INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (83,24,'My Events','notes.type=\'EV\' AND notes.createdby = {{$_SESSION[\'userinfo\'][\'id\']}}',0,0); 
     25INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (84,24,'Public Events','notes.type=\'EV\' AND notes.private=0',8,0); 
     26INSERT 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); 
     27INSERT 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); 
     28INSERT 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); 
     29INSERT 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); 
     30INSERT 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); 
     31INSERT 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); 
     32INSERT 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); 
     33INSERT 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); 
     34INSERT 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); 
     35INSERT 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); 
     36INSERT 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); 
     37INSERT 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); 
     38INSERT 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); 
     39INSERT 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); 
     40INSERT 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); 
     41INSERT 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); 
     42INSERT 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); 
     43INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (108,26,'All Records','files.id!=0',0,0); 
     44INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (200,200,'Active Roles','roles.inactive=0',0,0); 
     45INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (201,200,'Inactive Roles','roles.inactive=1',1,0); 
     46INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (202,200,'All Records','roles.id!=-100',2,0); 
  • trunk/phpbms/install/tableoptions.sql

    r145 r170  
    1 INSERT INTO tableoptions VALUES (8,9,'new','1',0,0); 
    2 INSERT INTO tableoptions VALUES (9,9,'edit','1',0,0); 
    3 INSERT INTO tableoptions VALUES (10,9,'select','1',0,0); 
    4 INSERT INTO tableoptions VALUES (16,10,'new','1',0,0); 
    5 INSERT INTO tableoptions VALUES (17,10,'select','1',0,0); 
    6 INSERT INTO tableoptions VALUES (18,10,'edit','1',0,0); 
    7 INSERT INTO tableoptions VALUES (11,11,'new','1',0,0); 
    8 INSERT INTO tableoptions VALUES (12,11,'select','1',0,0); 
    9 INSERT INTO tableoptions VALUES (13,11,'edit','1',0,0); 
    10 INSERT INTO tableoptions VALUES (24,12,'new','1',0,0); 
    11 INSERT INTO tableoptions VALUES (25,12,'edit','1',0,0); 
    12 INSERT INTO tableoptions VALUES (26,12,'select','1',0,0); 
    13 INSERT INTO tableoptions VALUES (62,12,'printex','1',0,0); 
    14 INSERT INTO tableoptions VALUES (27,12,'mark_asread','mark as read',1,0); 
    15 INSERT INTO tableoptions VALUES (19,16,'new','1',0,0); 
    16 INSERT INTO tableoptions VALUES (20,16,'select','1',0,0); 
    17 INSERT INTO tableoptions VALUES (21,16,'edit','1',0,0); 
    18 INSERT INTO tableoptions VALUES (22,17,'select','1',0,0); 
    19 INSERT INTO tableoptions VALUES (23,17,'edit','1',0,0); 
    20 INSERT INTO tableoptions VALUES (56,19,'new','1',0,0); 
    21 INSERT INTO tableoptions VALUES (57,19,'edit','1',0,0); 
    22 INSERT INTO tableoptions VALUES (58,19,'select','1',0,0); 
    23 INSERT INTO tableoptions VALUES (59,21,'edit','1',0,0); 
    24 INSERT INTO tableoptions VALUES (60,21,'select','1',0,0); 
    25 INSERT INTO tableoptions VALUES (69,23,'new','1',0,0); 
    26 INSERT INTO tableoptions VALUES (70,23,'edit','1',0,0); 
    27 INSERT INTO tableoptions VALUES (71,23,'select','1',0,0); 
    28 INSERT INTO tableoptions VALUES (72,23,'printex','1',0,0); 
    29 INSERT INTO tableoptions VALUES (77,23,'mark_asread','mark completed',1,0); 
    30 INSERT INTO tableoptions VALUES (73,24,'new','1',0,0); 
    31 INSERT INTO tableoptions VALUES (74,24,'edit','1',0,0); 
    32 INSERT INTO tableoptions VALUES (75,24,'select','1',0,0); 
    33 INSERT INTO tableoptions VALUES (76,24,'printex','1',0,0); 
    34 INSERT INTO tableoptions VALUES (78,24,'mark_asread','mark done',1,0); 
    35 INSERT INTO tableoptions VALUES (83,26,'new','1',0,-10); 
    36 INSERT INTO tableoptions VALUES (84,26,'select','1',0,-10); 
    37 INSERT INTO tableoptions VALUES (85,26,'edit','1',0,-10); 
    38 INSERT INTO tableoptions VALUES (86,27,'new','1',0,-10); 
    39 INSERT INTO tableoptions VALUES (87,27,'select','1',0,-10); 
    40 INSERT INTO tableoptions VALUES (88,27,'edit','1',0,-10); 
     1INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (8,9,'new','1',0,0); 
     2INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (9,9,'edit','1',0,0); 
     3INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (10,9,'select','1',0,0); 
     4INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (16,10,'new','1',0,0); 
     5INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (17,10,'select','1',0,0); 
     6INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (18,10,'edit','1',0,0); 
     7INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (11,11,'new','1',0,0); 
     8INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (12,11,'select','1',0,0); 
     9INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (13,11,'edit','1',0,0); 
     10INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (24,12,'new','1',0,0); 
     11INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (25,12,'edit','1',0,0); 
     12INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (26,12,'select','1',0,0); 
     13INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (62,12,'printex','1',0,0); 
     14INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (27,12,'mark_asread','mark as read',1,0); 
     15INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (19,16,'new','1',0,0); 
     16INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (20,16,'select','1',0,0); 
     17INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (21,16,'edit','1',0,0); 
     18INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (22,17,'select','1',0,0); 
     19INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (23,17,'edit','1',0,0); 
     20INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (56,19,'new','1',0,0); 
     21INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (57,19,'edit','1',0,0); 
     22INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (58,19,'select','1',0,0); 
     23INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (59,21,'edit','1',0,0); 
     24INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (60,21,'select','1',0,0); 
     25INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (69,23,'new','1',0,0); 
     26INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (70,23,'edit','1',0,0); 
     27INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (71,23,'select','1',0,0); 
     28INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (72,23,'printex','1',0,0); 
     29INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (77,23,'mark_asread','mark completed',1,0); 
     30INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (73,24,'new','1',0,0); 
     31INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (74,24,'edit','1',0,0); 
     32INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (75,24,'select','1',0,0); 
     33INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (76,24,'printex','1',0,0); 
     34INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (78,24,'mark_asread','mark done',1,0); 
     35INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (83,26,'new','1',0,0); 
     36INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (84,26,'select','1',0,0); 
     37INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (85,26,'edit','1',0,0); 
     38INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (86,27,'new','1',0,0); 
     39INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (87,27,'select','1',0,0); 
     40INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (88,27,'edit','1',0,0); 
     41INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (200,200,'new','1',0,0); 
     42INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (201,200,'select','1',0,0); 
     43INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (202,200,'edit','1',0,0); 
  • trunk/phpbms/install/tablesearchablefields.sql

    r145 r170  
    1 INSERT INTO tablesearchablefields VALUES (3,9,'(users.lastname like \"{{value}}%\" or users.firstname like \"{{value}}%\" )','name',0,'whereclause'); 
    2 INSERT INTO tablesearchablefields VALUES (5,9,'users.accesslevel','access level',2,'field'); 
    3 INSERT INTO tablesearchablefields VALUES (6,9,'users.login','log in name',1,'field'); 
    4 INSERT INTO tablesearchablefields VALUES (7,9,'users.id','id',3,'field'); 
    5 INSERT INTO tablesearchablefields VALUES (26,10,'relationships.id','id',0,'field'); 
    6 INSERT INTO tablesearchablefields VALUES (8,11,'tabledefs.maintable','main table',0,'field'); 
    7 INSERT INTO tablesearchablefields VALUES (9,11,'tabledefs.displayname','display',1,'field'); 
    8 INSERT INTO tablesearchablefields VALUES (10,11,'tabledefs.id','id',2,'field'); 
    9 INSERT INTO tablesearchablefields VALUES (35,12,'notes.subject','title',0,'field'); 
    10 INSERT INTO tablesearchablefields VALUES (36,12,'notes.content','content',2,'field'); 
    11 INSERT INTO tablesearchablefields VALUES (37,12,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause'); 
    12 INSERT INTO tablesearchablefields VALUES (38,12,'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"','assigned by',4,'whereclause'); 
    13 INSERT INTO tablesearchablefields VALUES (39,12,'notes.id','id',5,'field'); 
    14 INSERT INTO tablesearchablefields VALUES (81,12,'notes.category','category',1,'field'); 
    15 INSERT INTO tablesearchablefields VALUES (27,16,'reports.name','name',0,'field'); 
    16 INSERT INTO tablesearchablefields VALUES (28,16,'reports.reporttable','table',1,'field'); 
    17 INSERT INTO tablesearchablefields VALUES (29,16,'reports.type','type',2,'field'); 
    18 INSERT INTO tablesearchablefields VALUES (30,16,'reports.id','id',3,'field'); 
    19 INSERT INTO tablesearchablefields VALUES (31,17,'usersearches.name','name',0,'field'); 
    20 INSERT INTO tablesearchablefields VALUES (32,17,'({{value]]=\"global\" or users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\")','user',1,'whereclause'); 
    21 INSERT INTO tablesearchablefields VALUES (33,17,'usersearches.table','table',2,'field'); 
    22 INSERT INTO tablesearchablefields VALUES (34,17,'usersearches.id','id',3,'field'); 
    23 INSERT INTO tablesearchablefields VALUES (67,19,'menu.name','name',0,'field'); 
    24 INSERT INTO tablesearchablefields VALUES (68,19,'parentmenu.name','parent name',1,'field'); 
    25 INSERT INTO tablesearchablefields VALUES (69,19,'menu.id','id',2,'field'); 
    26 INSERT INTO tablesearchablefields VALUES (70,21,'modules.id','id',0,'field'); 
    27 INSERT INTO tablesearchablefields VALUES (83,23,'notes.subject','title',0,'field'); 
    28 INSERT INTO tablesearchablefields VALUES (84,23,'notes.category','category',1,'field'); 
    29 INSERT INTO tablesearchablefields VALUES (85,23,'notes.content','content',2,'field'); 
    30 INSERT INTO tablesearchablefields VALUES (86,23,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause'); 
    31 INSERT INTO tablesearchablefields VALUES (87,23,'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"','assigned by',4,'whereclause'); 
    32 INSERT INTO tablesearchablefields VALUES (88,23,'notes.id','id',5,'field'); 
    33 INSERT INTO tablesearchablefields VALUES (89,24,'notes.subject','title',0,'field'); 
    34 INSERT INTO tablesearchablefields VALUES (90,24,'notes.category','category',1,'field'); 
    35 INSERT INTO tablesearchablefields VALUES (91,24,'notes.content','content',2,'field'); 
    36 INSERT INTO tablesearchablefields VALUES (92,24,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause'); 
    37 INSERT INTO tablesearchablefields VALUES (93,24,'assignedby.firstname like','assigned by',4,'whereclause'); 
    38 INSERT INTO tablesearchablefields VALUES (94,24,'notes.id','id',5,'field'); 
    39 INSERT INTO tablesearchablefields VALUES (96,26,'files.name','name',0,'field'); 
     1INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,9,'(users.lastname like \"{{value}}%\" or users.firstname like \"{{value}}%\" )','name',0,'whereclause'); 
     2INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (5,9,'users.accesslevel','access level',2,'field'); 
     3INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (6,9,'users.login','log in name',1,'field'); 
     4INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (7,9,'users.id','id',3,'field'); 
     5INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (26,10,'relationships.id','id',0,'field'); 
     6INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,11,'tabledefs.maintable','main table',0,'field'); 
     7INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (9,11,'tabledefs.displayname','display',1,'field'); 
     8INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (10,11,'tabledefs.id','id',2,'field'); 
     9INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (35,12,'notes.subject','title',0,'field'); 
     10INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (36,12,'notes.content','content',2,'field'); 
     11INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (37,12,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause'); 
     12INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (38,12,'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"','assigned by',4,'whereclause'); 
     13INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (39,12,'notes.id','id',5,'field'); 
     14INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (81,12,'notes.category','category',1,'field'); 
     15INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (27,16,'reports.name','name',0,'field'); 
     16INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (28,16,'reports.reporttable','table',1,'field'); 
     17INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (29,16,'reports.type','type',2,'field'); 
     18INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (30,16,'reports.id','id',3,'field'); 
     19INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (31,17,'usersearches.name','name',0,'field'); 
     20INSERT 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'); 
     21INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (33,17,'usersearches.table','table',2,'field'); 
     22INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (34,17,'usersearches.id','id',3,'field'); 
     23INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (67,19,'menu.name','name',0,'field'); 
     24INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (68,19,'parentmenu.name','parent name',1,'field'); 
     25INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (69,19,'menu.id','id',2,'field'); 
     26INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (70,21,'modules.id','id',0,'field'); 
     27INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (83,23,'notes.subject','title',0,'field'); 
     28INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (84,23,'notes.category','category',1,'field'); 
     29INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (85,23,'notes.content','content',2,'field'); 
     30INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (86,23,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause'); 
     31INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (87,23,'assignedby.firstname like \"{{value}}%\"or assignedby.lastname like \"{{value}}%\"','assigned by',4,'whereclause'); 
     32INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (88,23,'notes.id','id',5,'field'); 
     33INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (89,24,'notes.subject','title',0,'field'); 
     34INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (90,24,'notes.category','category',1,'field'); 
     35INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (91,24,'notes.content','content',2,'field'); 
     36INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (92,24,'assignedto.firstname like \"{{value}}%\"or assignedto.lastname like \"{{value}}%\"','assigned to',3,'whereclause'); 
     37INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (93,24,'assignedby.firstname like','assigned by',4,'whereclause'); 
     38INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (94,24,'notes.id','id',5,'field'); 
     39INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (96,26,'files.name','name',0,'field'); 
     40INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (200,200,'roles.name','name',0,'field'); 
  • trunk/phpbms/install/updatexml.php

    r168 r170  
    157157                global $vars; 
    158158                 
    159                 $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=encode(\"".$pass."\",\"".$vars["encryption_seed"]."\") AND accesslevel>=90"; 
     159                $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=encode(\"".$pass."\",\"".$vars["encryption_seed"]."\") AND admin=1"; 
    160160                $queryresult=mysql_query($querystatement,$dblink); 
    161161                if(!$queryresult){ 
     
    309309                                        //Processing Data Structure Changes 
    310310                                        $thereturn.=processSQLfile("updatev0.7.sql"); 
     311                                         
     312                                        $querystatement="SELECT id,accesslevel FROM users WHERE accesslevel!=0"; 
     313                                        $queryresult=mysql_query($querystatement,$dblink); 
     314                                        while($therecord=mysql_fetch_array($queryresult)){ 
     315                                                while($therecord["accesslevel"]>1){ 
     316                                                        if($therecord["accesslevel"]==40) 
     317                                                                $therecord["accesslevel"]=$therecord["accesslevel"]-10; 
     318                                                        $querystatement="INSERT INTO rolestousers (userid,roleid) VALUES (".$therecord["id"].",".$therecord["accesslevel"].")"; 
     319                                                        $insertresult=mysql_query($querystatement,$dblink); 
     320                                                        $therecord["accesslevel"]=$therecord["accesslevel"]-10;                                                  
     321                                                } 
     322                                        }                                        
     323                                        $thereturn.=" - Connverted user access levels to roles.\n";                              
    311324 
    312325                                        //Updating Module Table 
  • trunk/phpbms/install/users.sql

    r145 r170  
    1 INSERT INTO users VALUES (1,'nologin','Tá€-Gó','EXTERNAL','',NOW(),0,-10,2,2,Now(),Now(),'','','',''); 
    2 INSERT INTO users VALUES (2,'admin',encode('phpbms','freeble'),'Administrator','',Now(),0,90,2,2,Now(),Now(),'','','',''); 
     1INSERT INTO `users` (`id`, `login`, `password`, `firstname`, `lastname`, `creationdate`, `revoked`, `createdby`, `modifiedby`, `lastlogin`, `modifieddate`, `email`, `phone`, `department`, `employeenumber`, `admin`, `portalaccess`) VALUES (1,'nologin','Tá€-Gó','phpBMS','Install',NOW(),1,1,1,NOW(),NULL,'','','','',0,1); 
     2INSERT INTO `users` (`id`, `login`, `password`, `firstname`, `lastname`, `creationdate`, `revoked`, `createdby`, `modifiedby`, `lastlogin`, `modifieddate`, `email`, `phone`, `department`, `employeenumber`, `admin`, `portalaccess`) VALUES (2,'admin',encode('phpbms','freeble'),'Administrator',' ',NOW(),0,1,1,NOW(),NULL,'','','','',1,0); 
  • trunk/phpbms/loadsearch.php

    r155 r170  
    3838*/ 
    3939        require("include/session.php"); 
     40        require("include/common_functions.php"); 
    4041         
    4142        function deleteSearch($id){ 
     
    108109        }//end function 
    109110 
    110         function showLoad($tabledefid,$basepath,$userid,$accesslevel){ 
     111        function showLoad($tabledefid,$basepath,$userid,$securitywhere){ 
    111112                global $dblink; 
    112113                 
    113114                $querystatement="SELECT id,name,userid FROM usersearches  
    114                                                 WHERE tabledefid=".$tabledefid." AND type=\"SCH\" AND ((userid=0 and accesslevel<=".$accesslevel.") OR userid=\"".$userid."\") ORDER BY userid, name"; 
     115                                                WHERE tabledefid=".$tabledefid." AND type=\"SCH\" AND ((userid=0 ".$securitywhere.") OR userid=\"".$userid."\") ORDER BY userid, name"; 
    115116                $queryresult = mysql_query($querystatement,$dblink); 
    116117                if(!$queryresult) reportError(500,"Cannot retrieve saved search infromation"); 
    117118                 
     119 
     120                $querystatement="SELECT advsearchroleid FROM tabledefs WHERE id=".$tabledefid ; 
     121                $tabledefresult = mysql_query($querystatement,$dblink); 
     122                if(!$tabledefresult) reportError(500,"Cannot retrieve table definition information."); 
     123                $tableinfo=mysql_fetch_array($tabledefresult); 
    118124                 
    119125                ?> 
     
    132138                                        </p> 
    133139                                        <p> 
    134                                                 <textarea id="LSSQL" rows="8" cols="10" <?php if($_SESSION["userinfo"]["accesslevel"]<30) echo " readonly=\"readonly\""?>></textarea> 
     140                                                <textarea id="LSSQL" rows="8" cols="10" <?php if(!hasRights($tableinfo["advsearchroleid"])) echo " readonly=\"readonly\""?>></textarea> 
    135141                                        </p> 
    136142                                </td> 
     
    148154                switch($_GET["cmd"]){ 
    149155                        case "show": 
    150                                 showLoad($_GET["tid"],$_GET["base"],$_SESSION["userinfo"]["id"],$_SESSION["userinfo"]["accesslevel"]); 
     156                                $securitywhere=""; 
     157                                if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0) 
     158                                        $securitywhere=" AND roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)";                     
     159                                showLoad($_GET["tid"],$_GET["base"],$_SESSION["userinfo"]["id"],$securitywhere); 
    151160                        break; 
    152161                        case "getsearch": 
  • trunk/phpbms/menu.php

    r166 r170  
    3838*/ 
    3939 
    40 function getMenu(){ 
    41         global $dblink; 
    42          
    43         $querystatement="SELECT id,name,link,accesslevel FROM menu WHERE parentid=0 ORDER BY displayorder"; 
     40function getMenu($dblink){ 
     41        $querystatement="SELECT id,name,link,roleid FROM menu WHERE parentid=0 ORDER BY displayorder"; 
    4442        $queryresult=mysql_query($querystatement,$dblink); 
    4543        if(!$queryresult) reportError(1,"Error Retrieving Menu"); 
     
    5149        global $dblink; 
    5250 
    53         $querystatement="SELECT id,name,link,accesslevel FROM menu WHERE parentid=".$parentid." ORDER BY displayorder"; 
     51        $querystatement="SELECT id,name,link,roleid FROM menu WHERE parentid=".$parentid." ORDER BY displayorder"; 
    5452        $queryresult=mysql_query($querystatement,$dblink); 
    5553        if(!$queryresult) reportError(1,"Error Retrieving Menu"); 
     
    5856} 
    5957 
    60         $menus=getMenu(); 
     58        $menus=getMenu($dblink); 
    6159        $nummenus=mysql_num_rows($menus); 
    6260 
     
    7573                $submenustring=""; 
    7674                while($menurecord=mysql_fetch_array($menus)){ 
    77                         if($_SESSION["userinfo"]["accesslevel"]>=$menurecord["accesslevel"]){ 
     75                        if(hasRights($menurecord["roleid"])){ 
    7876                                if($menurecord["link"]) { 
    7977                                        if(strpos($menurecord["link"],"http")!==0) 
     
    9088                                                                $sep=true; 
    9189                                                        else{ 
    92                                                                 if($_SESSION["userinfo"]["accesslevel"]>=$subrecord["accesslevel"]){ 
     90                                                                if(hasRights($menurecord["roleid"])){ 
    9391                                                                        if(strpos($subrecord["link"],"http")!==0) 
    9492                                                                                $subrecord["link"]=$_SESSION["app_path"].$subrecord["link"]; 
  • trunk/phpbms/modules/base/files_addedit.php

    r164 r170  
    8686                        <input id="id" name="id" type="text" value="<?php echo $therecord["id"]; ?>" size="5" maxlength="5" readonly="true" class="uneditable" />                
    8787                </p> 
    88                 <p id="accesslevellabel"> 
    89                         <label for="accesslevel">access level</label><br /> 
    90                         <?php  
    91                                 $choices=array(); 
    92                                 switch(TRUE){ 
    93                                         case ($_SESSION["userinfo"]["accesslevel"]>=90): 
    94                                                 $choices[]=array("value"=>"90","name"=>"Administrator"); 
    95                                         case ($_SESSION["userinfo"]["accesslevel"]>=50): 
    96                                                 $choices[]=array("value"=>"50","name"=>"Upper Manager"); 
    97                                         case ($_SESSION["userinfo"]["accesslevel"]>=30): 
    98                                                 $choices[]=array("value"=>"30","name"=>"Manager (sales manager)"); 
    99                                         case ($_SESSION["userinfo"]["accesslevel"]>=20): 
    100                                                 $choices[]=array("value"=>"20","name"=>"Power User (sales)"); 
    101                                         case ($_SESSION["userinfo"]["accesslevel"]>=10): 
    102                                                 $choices[]=array("value"=>"10","name"=>"basic user (shipping)"); 
    103                                 } 
    104                                 basic_choicelist("accesslevel",$therecord["accesslevel"],$choices,Array("class"=>"important","tabindex"=>"10")); 
    105                         ?><br /><span class="notes">The minimum access level required to view this attachment.</span> 
     88                <p id="roleidP"> 
     89                        <label for="roleid">access (role)</label><br /> 
     90                        <?php roles_choicelist("roleid",$therecord["roleid"],$dblink)?> 
    10691                </p> 
    10792        </fieldset> 
     
    142127                                <p id="fileidlabel"> 
    143128                                        <label for="fileid-ds" >existing file name</label><br /> 
    144                                         <?php autofill("fileid","",26,"files.id","files.name","if(length(files.description)>20,concat(left(files.description,17),\"...\"),files.description)","files.id!=1 AND files.accesslevel<=".$_SESSION["userinfo"]["accesslevel"],Array("size"=>"40","maxlength"=>"128","style"=>"",false)) ?>                            
     129                                        <?php  
     130                                                 
     131                                                $securitywhere=""; 
     132                                                if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0)                
     133                                                        $securitywhere=" AND files.roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)"; 
     134                                                autofill("fileid","",26,"files.id","files.name","if(length(files.description)>20,concat(left(files.description,17),\"...\"),files.description)","files.id!=1 ".$securitywhere,Array("size"=>"40","maxlength"=>"128","style"=>"",false))  
     135                                        ?>                               
    145136                                </p> 
    146137                        <?php }?> 
  • trunk/phpbms/modules/base/include/adminsettings_include.php

    r145 r170  
    116116 
    117117//process commands 
     118if(!hasRights(-100)) 
     119        goURL($_SESSION["app_path"]."noaccess.php"); 
     120 
    118121if (isset($_POST["command"])) { 
    119122        switch($_POST["command"]){ 
  • trunk/phpbms/modules/base/include/attachments_addedit_include.php

    r166 r170  
    5858         
    5959        $querystatement="SELECT 
    60                                 files.id,attachments.id as attachmentid,name,description,type,accesslevel,ISNULL(file) as nofile, 
     60                                files.id,attachments.id as attachmentid,name,description,type,roleid,ISNULL(file) as nofile, 
    6161                                 
    6262                                attachments.createdby, attachments.creationdate,  
     
    8080        $therecord["description"]=""; 
    8181        $therecord["type"]=""; 
    82         $therecord["accesslevel"]=0; 
     82        $therecord["roleid"]=0; 
    8383         
    8484        $therecord["createdby"]=$_SESSION["userinfo"]["id"]; 
     
    100100                        $name=$variables["name"]; 
    101101                        $querystatement.="description=\"".$variables["description"]."\", ";  
    102                         $querystatement.="accesslevel=".$variables["accesslevel"].", ";  
     102                        $querystatement.="roleid=".$variables["roleid"].", ";  
    103103                        if($_FILES['upload']["name"]){ 
    104104                                $name=$_FILES['upload']["name"]; 
     
    141141                $querystatement="INSERT INTO files "; 
    142142                 
    143                 $querystatement.="(name,description,accesslevel,type,file, 
     143                $querystatement.="(name,description,roleid,type,file, 
    144144                                                        createdby,creationdate,modifiedby) VALUES ("; 
    145145                 
    146146                                $querystatement.="\"".$_FILES['upload']["name"]."\", ";  
    147147                                $querystatement.="\"".$variables["description"]."\", ";  
    148                                 $querystatement.=$variables["accesslevel"].", ";  
     148                                $querystatement.=$variables["roleid"].", ";  
    149149                                $querystatement.="\"".$_FILES['upload']['type']."\", "; 
    150150                                $querystatement.="\"".$file."\", "; 
     
    186186//================================================================== 
    187187if(!isset($_POST["command"])){ 
    188         if(isset($_GET["id"])) 
     188        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     189        $tableresult=mysql_query($querystatement,$dblink); 
     190        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     191        $tablerecord=mysql_fetch_array($tableresult); 
     192         
     193        if(isset($_GET["id"])){ 
     194                //editing 
     195                if(!hasRights($tablerecord["editroleid"])) 
     196                        goURL($_SESSION["app_path"]."noaccess.php"); 
    189197                $therecord=getRecords((integer) $_GET["id"]); 
    190         else 
     198        } else { 
     199                if(!hasRights($tablerecord["addroleid"])) 
     200                        goURL($_SESSION["app_path"]."noaccess.php"); 
    191201                $therecord=setRecordDefaults(); 
     202        } 
    192203        $createdby=getUserName($therecord["createdby"]); 
    193204        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/include/files_addedit_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141 
    4242// These following functions and processing are similar for all pages 
     
    5252         
    5353        $querystatement="SELECT 
    54                                 id,name,description,type,accesslevel, 
     54                                id,name,description,type,roleid, 
    5555                                 
    5656                                createdby, creationdate,  
     
    7373        $therecord["description"]=""; 
    7474        $therecord["type"]=""; 
    75         $therecord["accesslevel"]=0; 
     75        $therecord["roleid"]=0; 
    7676         
    7777        $therecord["createdby"]=$_SESSION["userinfo"]["id"]; 
     
    9393                        $name=$variables["name"]; 
    9494                        $querystatement.="description=\"".$variables["description"]."\", ";  
    95                         $querystatement.="accesslevel=".$variables["accesslevel"].", ";  
     95                        $querystatement.="roleid=".$variables["roleid"].", ";  
    9696                        if($_FILES['upload']["name"]){ 
    9797                                $name=$_FILES['upload']["name"]; 
     
    132132        $querystatement="INSERT INTO files "; 
    133133         
    134         $querystatement.="(name,description,accesslevel,type,file, 
     134        $querystatement.="(name,description,roleid,type,file, 
    135135                                                createdby,creationdate,modifiedby) VALUES ("; 
    136136         
    137137                        $querystatement.="\"".$_FILES['upload']["name"]."\", ";  
    138138                        $querystatement.="\"".$variables["description"]."\", ";  
    139                         $querystatement.=$variables["accesslevel"].", ";  
     139                        $querystatement.=$variables["roleid"].", ";  
    140140                        $querystatement.="\"".$_FILES['upload']['type']."\", "; 
    141141                        $querystatement.="\"".$file."\", "; 
     
    158158//================================================================== 
    159159if(!isset($_POST["command"])){ 
    160         if(isset($_GET["id"])) 
     160        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     161        $tableresult=mysql_query($querystatement,$dblink); 
     162        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     163        $tablerecord=mysql_fetch_array($tableresult); 
     164         
     165        if(isset($_GET["id"])){ 
     166                //editing 
     167                if(!hasRights($tablerecord["editroleid"])) 
     168                        goURL($_SESSION["app_path"]."noaccess.php"); 
    161169                $therecord=getRecords((integer) $_GET["id"]); 
    162         else 
     170        } else { 
     171                if(!hasRights($tablerecord["addroleid"])) 
     172                        goURL($_SESSION["app_path"]."noaccess.php"); 
    163173                $therecord=setRecordDefaults(); 
     174        } 
    164175        $createdby=getUserName($therecord["createdby"]); 
    165176        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/include/menu_addedit_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141 
    4242function displayTableDropDown($selectedlink){ 
     
    8585        global $dblink; 
    8686         
    87         $querystatement="SELECT id, name, link, parentid, displayorder, accesslevel, 
     87        $querystatement="SELECT id, name, link, parentid, displayorder, roleid, 
    8888                                createdby, creationdate,  
    8989                                modifiedby, modifieddate 
     
    104104        $therecord["parentid"]=0; 
    105105        $therecord["displayorder"]=0; 
    106         $therecord["accesslevel"]=0; 
     106        $therecord["roleid"]=0; 
    107107 
    108108        $therecord["createdby"]=$_SESSION["userinfo"]["id"]; 
     
    140140        } 
    141141        $querystatement.="displayorder=".$variables["displayorder"].", ";  
    142         $querystatement.="accesslevel=".$variables["accesslevel"].", ";  
     142        $querystatement.="roleid=".$variables["roleid"].", ";  
    143143 
    144144        //==== Almost all records should have this ========= 
     
    157157        $querystatement="INSERT INTO menu "; 
    158158         
    159         $querystatement.="(name,link,parentid,displayorder,accesslevel, 
     159        $querystatement.="(name,link,parentid,displayorder,roleid, 
    160160        createdby,creationdate,modifiedby) VALUES ("; 
    161161         
     
    177177        } 
    178178        $querystatement.=$variables["displayorder"].", ";  
    179         $querystatement.=$variables["accesslevel"].", ";  
     179        $querystatement.=$variables["roleid"].", ";  
    180180         
    181181        //==== Almost all records should have this ========= 
     
    195195//================================================================== 
    196196if(!isset($_POST["command"])){ 
    197         if(isset($_GET["id"])) 
     197        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     198        $tableresult=mysql_query($querystatement,$dblink); 
     199        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     200        $tablerecord=mysql_fetch_array($tableresult); 
     201         
     202        if(isset($_GET["id"])){ 
     203                //editing 
     204                if(!hasRights($tablerecord["editroleid"])) 
     205                        goURL($_SESSION["app_path"]."noaccess.php"); 
    198206                $therecord=getRecords((integer) $_GET["id"]); 
    199         else 
     207        } else { 
     208                if(!hasRights($tablerecord["addroleid"])) 
     209                        goURL($_SESSION["app_path"]."noaccess.php"); 
    200210                $therecord=setRecordDefaults(); 
     211        } 
    201212        $createdby=getUserName($therecord["createdby"]); 
    202213        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/include/notes_addedit_include.php

    r166 r170  
    397397//================================================================== 
    398398if(!isset($_POST["command"])){ 
    399         if(isset($_GET["id"])) 
     399        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     400        $tableresult=mysql_query($querystatement,$dblink); 
     401        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     402        $tablerecord=mysql_fetch_array($tableresult); 
     403         
     404        if(isset($_GET["id"])){ 
     405                //editing 
     406                if(!hasRights($tablerecord["editroleid"])) 
     407                        goURL($_SESSION["app_path"]."noaccess.php"); 
    400408                $therecord=getRecords((integer) $_GET["id"]); 
    401         else 
     409        } else { 
     410                if(!hasRights($tablerecord["addroleid"])) 
     411                        goURL($_SESSION["app_path"]."noaccess.php"); 
    402412                $therecord=setRecordDefaults(); 
     413        } 
    403414        $createdby=getUserName($therecord["createdby"]); 
    404415        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/include/notes_search_functions.php

    r145 r170  
    8181        if (!$repeatqueryresult) reportError(300,"Couldn't Delete: ".mysql_error($dblink)."<BR>\n SQL STATEMENT [".$querystatement."]");                 
    8282 
    83         $querystatement = "DELETE FROM notes WHERE ((notes.createdby=".$_SESSION["userinfo"]["id"]." or notes.assignedtoid=".$_SESSION["userinfo"]["id"].") OR (".$_SESSION["userinfo"]["accesslevel"]." >=90)) and (".$whereclause.") and (notes.`repeat`!=1);"; 
     83        $querystatement = "DELETE FROM notes WHERE ((notes.createdby=".$_SESSION["userinfo"]["id"]." or notes.assignedtoid=".$_SESSION["userinfo"]["id"].") OR (".$_SESSION["userinfo"]["admin"]." =1)) and (".$whereclause.") and (notes.`repeat`!=1);"; 
    8484        $queryresult = mysql_query($querystatement,$dblink); 
    8585        if (!$queryresult) reportError(300,"Couldn't Delete: ".mysql_error($dblink)."<BR>\n SQL STATEMENT [".$querystatement."]");               
  • trunk/phpbms/modules/base/include/relationships_addedit_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141 
    4242function displayTables($fieldname,$selectedid){ 
     
    162162//================================================================== 
    163163if(!isset($_POST["command"])){ 
    164         if(isset($_GET["id"])) 
     164        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     165        $tableresult=mysql_query($querystatement,$dblink); 
     166        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     167        $tablerecord=mysql_fetch_array($tableresult); 
     168         
     169        if(isset($_GET["id"])){ 
     170                //editing 
     171                if(!hasRights($tablerecord["editroleid"])) 
     172                        goURL($_SESSION["app_path"]."noaccess.php"); 
    165173                $therecord=getRecords((integer) $_GET["id"]); 
    166         else 
     174        } else { 
     175                if(!hasRights($tablerecord["addroleid"])) 
     176                        goURL($_SESSION["app_path"]."noaccess.php"); 
    167177                $therecord=setRecordDefaults(); 
     178        } 
    168179        $createdby=getUserName($therecord["createdby"]); 
    169180        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/include/reports_addedit_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141 
    4242function displayTables($fieldname,$selectedid){ 
     
    7575         
    7676        $querystatement="SELECT 
    77                                 id,name,type,reportfile,tabledefid,description,displayorder,accesslevel, 
     77                                id,name,type,reportfile,tabledefid,description,displayorder,roleid, 
    7878                                 
    7979                                createdby, creationdate,  
     
    9898        $therecord["reportfile"]=""; 
    9999        $therecord["displayorder"]=0; 
    100         $therecord["accesslevel"]=10; 
     100        $therecord["roleid"]=0; 
    101101        $therecord["description"]=""; 
    102102         
     
    123123                        $querystatement.="description=\"".$variables["description"]."\", ";  
    124124                        $querystatement.="displayorder=".$variables["displayorder"].", ";  
    125                         $querystatement.="accesslevel=".$variables["accesslevel"].", ";  
     125                        $querystatement.="roleid=".$variables["roleid"].", ";  
    126126 
    127127        //==== Almost all records should have this ========= 
     
    140140        $querystatement="INSERT INTO reports "; 
    141141         
    142         $querystatement.="(name,type,tabledefid,reportfile,description,displayorder,accesslevel, 
     142        $querystatement.="(name,type,tabledefid,reportfile,description,displayorder,roleid, 
    143143                                                createdby,creationdate,modifiedby) VALUES ("; 
    144144         
     
    149149                        $querystatement.="\"".$variables["description"]."\", ";  
    150150                        $querystatement.=$variables["displayorder"].", ";  
    151                         $querystatement.=$variables["accesslevel"].", ";  
     151                        $querystatement.=$variables["roleid"].", ";  
    152152                                 
    153153        //==== Almost all records should have this ========= 
     
    168168//================================================================== 
    169169if(!isset($_POST["command"])){ 
    170         if(isset($_GET["id"])) 
     170        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     171        $tableresult=mysql_query($querystatement,$dblink); 
     172        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     173        $tablerecord=mysql_fetch_array($tableresult); 
     174         
     175        if(isset($_GET["id"])){ 
     176                //editing 
     177                if(!hasRights($tablerecord["editroleid"])) 
     178                        goURL($_SESSION["app_path"]."noaccess.php"); 
    171179                $therecord=getRecords((integer) $_GET["id"]); 
    172         else 
     180        } else { 
     181                if(!hasRights($tablerecord["addroleid"])) 
     182                        goURL($_SESSION["app_path"]."noaccess.php"); 
    173183                $therecord=setRecordDefaults(); 
     184        } 
    174185        $createdby=getUserName($therecord["createdby"]); 
    175186        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/include/tabledefs_addedit_include.php

    r166 r170  
    4141//======================================================================================== 
    4242//======================================================================================== 
    43 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     43 
    4444 
    4545//set table id 
     
    5353                                id,maintable,displayname,querytable,addfile,editfile,deletebutton,type,moduleid, 
    5454                                defaultwhereclause,defaultsortorder,defaultsearchtype,defaultcriteriafindoptions,defaultcriteriaselection, 
     55                                searchroleid,addroleid,editroleid,advsearchroleid,viewsqlroleid, 
    5556 
    5657                                createdby, creationdate,  
     
    7677        $therecord["addfile"]=""; 
    7778        $therecord["editfile"]=""; 
     79        $therecord["addroleid"]=0; 
     80        $therecord["editroleid"]=0; 
    7881        $therecord["moduleid"]=1; 
    7982 
     
    8184        $therecord["type"]="table"; 
    8285 
     86        $therecord["searchroleid"]=0; 
     87        $therecord["advsearchroleid"]=-100; 
     88        $therecord["viewsqlroleid"]=-100; 
    8389        $therecord["defaultwhereclause"]=""; 
    8490        $therecord["defaultcriteriafindoptions"]=""; 
     
    8692        $therecord["defaultsortorder"]=""; 
    8793 
    88         $therecord["defaultsearchtype"]="search"; 
     94        $therecord["defaultsearchtype"]=""; 
    8995 
    9096        $therecord["createdby"]=$_SESSION["userinfo"]["id"]; 
     
    120126                        $querystatement.="defaultcriteriafindoptions=\"".$variables["defaultcriteriafindoptions"]."\", ";  
    121127                        $querystatement.="defaultcriteriaselection=\"".$variables["defaultcriteriaselection"]."\", ";  
     128 
     129                        $querystatement.="searchroleid=".$variables["searchroleid"].", ";  
     130                        $querystatement.="addroleid=".$variables["addroleid"].", ";  
     131                        $querystatement.="editroleid=".$variables["editroleid"].", ";  
     132                        $querystatement.="advsearchroleid=".$variables["advsearchroleid"].", ";  
     133                        $querystatement.="viewsqlroleid=".$variables["viewsqlroleid"].", ";  
    122134 
    123135        //==== Almost all records should have this ========= 
     
    137149         
    138150        $querystatement.="(maintable,querytable,displayname,type,moduleid,addfile,editfile,deletebutton, 
    139                                                 defaultwhereclause,defaultsortorder,defaultsearchtype,defaultcriteriafindoptions,defaultcriteriaselection, 
     151                                                defaultwhereclause,defaultsortorder,defaultsearchtype,defaultcriteriafindoptions,defaultcriteriaselection,\ 
     152                                                searchroleid,addroleid,editroleid,advsearchroleid,viewsqlroleid, 
     153                                                 
    140154                                                createdby,creationdate,modifiedby) VALUES ("; 
    141155         
     
    156170                        $querystatement.="\"".$variables["defaultcriteriafindoptions"]."\", ";  
    157171                        $querystatement.="\"".$variables["defaultcriteriaselection"]."\", ";  
     172                         
     173                        $querystatement.=$variables["searchroleid"].", ";  
     174                        $querystatement.=$variables["addroleid"].", ";  
     175                        $querystatement.=$variables["editroleid"].", ";                          
     176                        $querystatement.=$variables["advsearchroleid"].", ";  
     177                        $querystatement.=$variables["viewsqlroleid"].", ";  
    158178                                 
    159179        //==== Almost all records should have this ========= 
     
    174194//================================================================== 
    175195if(!isset($_POST["command"])){ 
    176         if(isset($_GET["id"])) 
     196        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     197        $tableresult=mysql_query($querystatement,$dblink); 
     198        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     199        $tablerecord=mysql_fetch_array($tableresult); 
     200         
     201        if(isset($_GET["id"])){ 
     202                //editing 
     203                if(!hasRights($tablerecord["editroleid"])) 
     204                        goURL($_SESSION["app_path"]."noaccess.php"); 
    177205                $therecord=getRecords((integer) $_GET["id"]); 
    178         else 
     206        } else { 
     207                if(!hasRights($tablerecord["addroleid"])) 
     208                        goURL($_SESSION["app_path"]."noaccess.php"); 
    179209                $therecord=setRecordDefaults(); 
     210        } 
    180211        $createdby=getUserName($therecord["createdby"]); 
    181212        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/include/tabledefs_columns_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141 
    4242        function setColumnDefaults(){ 
  • trunk/phpbms/modules/base/include/tabledefs_functions.php

    r166 r170  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
    39  
    40 // access level to admin area 
    41 if($_SESSION["userinfo"]["accesslevel"]<90) 
    42         goURL("noaccess.html"); 
    43  
    4439//format tabs for user admin. 
    4540function tabledefs_tabs($selected="none",$id=0) { 
  • trunk/phpbms/modules/base/include/tabledefs_options_include.php

    r166 r170  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
    39         if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     39         
    4040        function setOptionDefaults(){ 
    4141                $therecord["id"]=NULL;           
     
    4343                $therecord["option"]="";                 
    4444                $therecord["othercommand"]=0;            
    45                 $therecord["accesslevel"]=0;             
     45                $therecord["roleid"]=0;          
    4646 
    4747                return $therecord;               
     
    5151                global $dblink; 
    5252 
    53                 $querystatement="SELECT id, name, `option`, othercommand, accesslevel 
    54                 FROM tableoptions  
     53                $querystatement="SELECT tableoptions.id, tableoptions.name, tableoptions.option, tableoptions.othercommand, tableoptions.roleid, roles.name as rolename 
     54                FROM tableoptions LEFT JOIN roles ON tableoptions.roleid=roles.id 
    5555                WHERE tabledefid=".$tabledefid; 
    56                 if($optionid) $querystatement.=" AND id=".$optionid; 
    57                 $querystatement.=" ORDER BY othercommand, id"; 
     56                if($optionid) $querystatement.=" AND tableoptions.id=".$optionid; 
     57                $querystatement.=" ORDER BY othercommand, tableoptions.id"; 
    5858                 
    5959                $queryresult=mysql_query($querystatement,$dblink); 
     
    6666        function addOption($variables,$tabledefid){ 
    6767                global $dblink; 
    68                 $querystatement="INSERT INTO tableoptions (tabledefid, accesslevel, name, `option`, othercommand) 
     68                $querystatement="INSERT INTO tableoptions (tabledefid, roleid, name, `option`, othercommand) 
    6969                values ("; 
    7070                $querystatement.=$tabledefid.", "; 
    71                 $querystatement.=$variables["accesslevel"].", "; 
     71                $querystatement.=$variables["roleid"].", "; 
    7272                if($variables["othercommand"]==1) { 
    7373                        $querystatement.="\"".$variables["name"]."\", "; 
     
    8888                $querystatement="UPDATE tableoptions set "; 
    8989                $querystatement.="othercommand=".$variables["othercommand"].", ";                
    90                 $querystatement.="accesslevel=".$variables["accesslevel"].", "; 
     90                $querystatement.="roleid=".$variables["roleid"].", "; 
    9191                if($variables["othercommand"]==1) { 
    9292                        $querystatement.="name=\"".$variables["name"]."\", "; 
  • trunk/phpbms/modules/base/include/tabledefs_quicksearch_include.php

    r166 r170  
    3838*/ 
    3939 
    40         if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40         
    4141        function setDefaultQuickSearch(){ 
    4242                $therecord["id"]=NULL;           
     
    4444 
    4545                $therecord["name"]="";           
    46                 $therecord["accesslevel"]=11;            
     46                $therecord["roleid"]=0;          
    4747                $therecord["search"]="";                 
    4848 
     
    5252        function getQuicksearchs($tabledefid,$quicksearchid=false){ 
    5353                global $dblink; 
    54                 $querystatement="SELECT id, name, `search`, displayorder, accesslevel 
    55                 FROM tablefindoptions  
    56                 WHERE tabledefid=".$tabledefid; 
    57                 if($quicksearchid) $querystatement.=" AND id=".$quicksearchid; 
    58                 $querystatement.=" ORDER BY displayorder"; 
     54                $querystatement="SELECT tablefindoptions.id, tablefindoptions.name, tablefindoptions.search, tablefindoptions.displayorder, roleid, 
     55                roles.name as rolename 
     56                FROM tablefindoptions LEFT JOIN roles ON tablefindoptions.roleid=roles.id 
     57                WHERE tablefindoptions.tabledefid=".$tabledefid; 
     58                if($quicksearchid) $querystatement.=" AND tablefindoptions.id=".$quicksearchid; 
     59                $querystatement.=" ORDER BY tablefindoptions.displayorder"; 
    5960                 
    6061                $thequery=mysql_query($querystatement) or $thequery=mysql_error($dblink)." -- ".$querystatement;                 
     
    6566        function addQuicksearch($variables,$tabledefid){ 
    6667                global $dblink; 
    67                 $querystatement="INSERT INTO tablefindoptions (tabledefid, name, `search`, accesslevel, displayorder) 
     68                $querystatement="INSERT INTO tablefindoptions (tabledefid, name, `search`, roleid, displayorder) 
    6869                values ("; 
    6970                $querystatement.=$tabledefid.", "; 
    7071                $querystatement.="\"".$variables["name"]."\", "; 
    7172                $querystatement.="\"".$variables["search"]."\", "; 
    72                 $querystatement.="\"".$variables["accesslevel"]."\", "; 
     73                $querystatement.="\"".$variables["roleid"]."\", "; 
    7374                $querystatement.="\"".$variables["displayorder"]."\")";          
    7475                if(mysql_query($querystatement)) $thereturn ="Quick Search Item Added"; else $thereturn=mysql_error($dblink)." -- ".$querystatement; 
     
    8283                $querystatement="UPDATE tablefindoptions set "; 
    8384                $querystatement.="name=\"".$variables["name"]."\", "; 
    84                 $querystatement.="accesslevel=\"".$variables["accesslevel"]."\", "; 
     85                $querystatement.="roleid=\"".$variables["roleid"]."\", "; 
    8586                $querystatement.="`search`=\"".$variables["search"]."\" "; 
    8687                $querystatement.="WHERE id=".$variables["quicksearchid"]; 
  • trunk/phpbms/modules/base/include/tabledefs_searchfields_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141        function setDefaultSearchField(){ 
    4242                $therecord["id"]=NULL;           
  • trunk/phpbms/modules/base/include/usersearches_edit_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141 
    4242function displayTables($fieldname,$selectedid){ 
     
    6767         
    6868        $querystatement="SELECT 
    69                                 id, name, userid, tabledefid, sqlclause, type, accesslevel  
     69                                id, name, userid, tabledefid, sqlclause, type, roleid  
    7070                                 
    7171                                FROM usersearches 
     
    8787        $therecord["tabledefid"]=NULL; 
    8888        $therecord["sqlclause"]=""; 
    89         $therecord["accesslevel"]=10; 
     89        $therecord["roleid"]=0; 
    9090        $therecord["type"]=""; 
    9191 
     
    108108                        $querystatement.="name=\"".$variables["name"]."\", ";  
    109109                        $querystatement.="tabledefid=\"".$variables["tabledefid"]."\", ";  
    110                         if(isset($variables["accesslevel"]))$querystatement.="accesslevel=\"".$variables["accesslevel"]."\", ";  
     110                        if(isset($variables["roleid"]))$querystatement.="roleid=\"".$variables["roleid"]."\", ";  
    111111                        if(isset($variables["type"]))$querystatement.="type=\"".$variables["type"]."\", ";  
    112112                        $querystatement.="sqlclause=\"".$variables["sqlclause"]."\" ";  
     
    126126//================================================================== 
    127127if(!isset($_POST["command"])){ 
    128         if(isset($_GET["id"])) 
     128        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     129        $tableresult=mysql_query($querystatement,$dblink); 
     130        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     131        $tablerecord=mysql_fetch_array($tableresult); 
     132         
     133        if(isset($_GET["id"])){ 
     134                //editing 
     135                if(!hasRights($tablerecord["editroleid"])) 
     136                        goURL($_SESSION["app_path"]."noaccess.php"); 
    129137                $therecord=getRecords((integer) $_GET["id"]); 
    130         else 
     138        } else { 
     139                if(!hasRights($tablerecord["addroleid"])) 
     140                        goURL($_SESSION["app_path"]."noaccess.php"); 
    131141                $therecord=setRecordDefaults(); 
     142        } 
    132143        $username=getUserName($therecord["userid"]); 
    133144        if(!$username) $username="global"; 
  • trunk/phpbms/modules/base/include/users_addedit_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141 
    4242// These following functions and processing are similar for all pages 
     
    4747$tableid=9; 
    4848 
     49function assignRoles($id,$roles,$dblink){ 
     50        $querystatement="DELETE FROM rolestousers WHERE userid=".$id; 
     51        $queryresult=mysql_query($querystatement,$dblink); 
     52        if(!$queryresult) reportError(300,"Could not remove existing user roles: ".$querystatement); 
     53        $newroles=explode(",",$roles); 
     54        foreach($newroles as $therole) 
     55                if($therole!=""){ 
     56                        $querystatement="INSERT INTO rolestousers (userid,roleid) VALUES(".$id.",".$therole.")"; 
     57                        $queryresult=mysql_query($querystatement,$dblink); 
     58                        if(!$queryresult) reportError(300,"Could not add new role."); 
     59                } 
     60} 
     61 
     62function displayRoles($id,$type,$dblink){ 
     63        $querystatement="SELECT roles.id,roles.name 
     64                                        FROM roles INNER JOIN rolestousers ON rolestousers.roleid=roles.id  
     65                                        WHERE rolestousers.userid=".$id; 
     66        $assignedquery=mysql_query($querystatement,$dblink); 
     67        if(!$assignedquery) reportError(300,"Could not retrieve assigned roles ".mysql_query($dblink)); 
     68        $thelist=array(); 
     69         
     70        if($type=="available"){ 
     71                $excludelist=array(); 
     72                while($therecord=mysql_fetch_array($assignedquery)) 
     73                        $excludelist[]=$therecord["id"]; 
     74                         
     75                $querystatement="SELECT id,name FROM roles WHERE inactive=0"; 
     76                $availablequery=mysql_query($querystatement,$dblink); 
     77                if(!$availablequery) reportError(300,"Could not retrieve available roles"); 
     78                while($therecord=mysql_fetch_array($availablequery)) 
     79                        if(!in_array($therecord["id"],$excludelist)) 
     80                                $thelist[]=$therecord;           
     81        } else  
     82                while($therecord=mysql_fetch_array($assignedquery)) 
     83                        $thelist[]=$therecord; 
     84                         
     85        foreach($thelist as $theoption){ 
     86                ?>      <option value="<?php echo $theoption["id"]?>"><?php echo htmlQuotes($theoption["name"])?></option> 
     87<?php  
     88        } 
     89} 
     90 
    4991function getRecords($id){ 
    5092//======================================================================================== 
    5193        global $dblink; 
    5294         
    53         $querystatement="select id, login, firstname, lastname, accesslevel,  
     95        $querystatement="select id, login, firstname, lastname, admin,portalaccess, 
    5496                                date_Format(lastlogin,\"%c/%e/%Y %T\") as lastlogin, revoked, 
    5597                                email,phone,department,employeenumber, 
     
    81123 
    82124        $therecord["revoked"]=0; 
    83         $therecord["accesslevel"]=10; 
     125        $therecord["admin"]=0; 
     126        $therecord["portalaccess"]=0; 
    84127        $therecord["lastlogin"]=NULL; 
    85128         
     
    109152        $querystatement.="employeenumber=\"".$variables["employeenumber"]."\", ";  
    110153 
    111         $querystatement.="accesslevel=".$variables["accesslevel"].", ";  
     154        if($variables["password"]) $querystatement.="password=encode(\"".$variables["password"]."\",\"".$_SESSION["encryption_seed"]."\"), ";  
     155 
    112156        if(isset($variables["revoked"])) $querystatement.="revoked=1, "; else $querystatement.="revoked=0, "; 
    113  
    114         if($variables["password"]) $querystatement.="password=encode(\"".$variables["password"]."\",\"".$_SESSION["encryption_seed"]."\"), ";  
     157        if(isset($variables["admin"])) $querystatement.="admin=1, "; else $querystatement.="admin=0, "; 
     158        if(isset($variables["portalaccess"])) $querystatement.="portalaccess=1, "; else $querystatement.="portalaccess=0, "; 
    115159 
    116160        //==== Almost all records should have this ========= 
     
    120164        $thequery = mysql_query($querystatement,$dblink); 
    121165        if(!$thequery) reportError(300,"Update Failed: ".mysql_error($dblink)." -- ".$querystatement); 
     166         
     167        if($variables["roleschanged"]==1) 
     168                assignRoles($variables["id"],$variables["newroles"],$dblink); 
    122169}// end function 
    123170 
     
    130177         
    131178        $querystatement.="(login,lastname,firstname,email,phone,department,employeenumber, 
    132                                                 password,accesslevel,revoked, 
     179                                                password,revoked,admin,portalaccess, 
    133180        createdby,creationdate,modifiedby) VALUES ("; 
    134181         
     
    143190         
    144191        $querystatement.="encode(\"".$variables["password"]."\",\"".$_SESSION["encryption_seed"]."\"), ";  
    145         $querystatement.=$variables["accesslevel"].", "; 
    146192        if(isset($variables["revoked"])) $querystatement.="1, "; else $querystatement.="0, "; 
     193        if(isset($variables["admin"])) $querystatement.="1, "; else $querystatement.="0, "; 
     194        if(isset($variables["portalaccess"])) $querystatement.="1, "; else $querystatement.="0, "; 
    147195         
    148196        //==== Almost all records should have this ========= 
     
    153201        $thequery = mysql_query($querystatement,$dblink); 
    154202        if(!$thequery) die ("Insert Failed: ".mysql_error($dblink)." -- ".$querystatement); 
    155         return mysql_insert_id($dblink); 
     203 
     204        $newid=mysql_insert_id($dblink); 
     205 
     206        return $newid; 
    156207} 
    157208 
     
    162213//================================================================== 
    163214if(!isset($_POST["command"])){ 
    164         if(isset($_GET["id"])) 
     215        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     216        $tableresult=mysql_query($querystatement,$dblink); 
     217        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     218        $tablerecord=mysql_fetch_array($tableresult); 
     219         
     220        if(isset($_GET["id"])){ 
     221                //editing 
     222                if(!hasRights($tablerecord["editroleid"])) 
     223                        goURL($_SESSION["app_path"]."noaccess.php"); 
    165224                $therecord=getRecords((integer) $_GET["id"]); 
    166         else 
     225        } else { 
     226                if(!hasRights($tablerecord["addroleid"])) 
     227                        goURL($_SESSION["app_path"]."noaccess.php"); 
    167228                $therecord=setRecordDefaults(); 
     229        } 
    168230        $createdby=getUserName($therecord["createdby"]); 
    169231        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/base/javascript/file.js

    r145 r170  
    4242        var newlabel=getObjectFromID("fileidlabel"); 
    4343        var existinglabel=getObjectFromID("uploadlabel"); 
    44         var accesslevel=getObjectFromID("accesslevellabel"); 
     44        var roleid=getObjectFromID("roleidP"); 
    4545        var descriptionlabel=getObjectFromID("descriptionlabel"); 
    4646 
     
    4848                newlabel.style.display="none"; 
    4949                existinglabel.style.display="block"; 
    50                 accesslevel.style.display="block"; 
     50                roleid.style.display="block"; 
    5151                descriptionlabel.style.display="block"; 
    5252        } else { 
    5353                newlabel.style.display="block"; 
    5454                existinglabel.style.display="none"; 
    55                 accesslevel.style.display="none"; 
     55                roleid.style.display="none"; 
    5656                descriptionlabel.style.display="none"; 
    5757        } 
  • trunk/phpbms/modules/base/menu_addedit.php

    r155 r170  
    5252<link href="../../common/stylesheet/<?php echo $_SESSION["stylesheet"] ?>/pages/menus.css" rel="stylesheet" type="text/css" /> 
    5353<script language="JavaScript" src="../../common/javascript/fields.js" type="text/javascript"></script> 
    54 <script language="JavaScript" src="javascript/menu.js"></script> 
    5554</head> 
    5655<body><?php include("../../menu.php")?> 
     
    7170                <p> 
    7271                        <label for="displayorder">display order</label><br /> 
    73                          <?php field_text("displayorder",$therecord["displayorder"],1,"Display order cannot be blank and must be a valid integer.","integer",Array("size"=>"9","maxlength"=>"3")); ?><br> 
     72                         <?php field_text("displayorder",$therecord["displayorder"],1,"Display order cannot be blank and must be a valid integer.","integer",Array("size"=>"9","maxlength"=>"3")); ?><br /> 
    7473                         <span class="notes"><strong>Note:</strong> Lower numbers are displayed first.</span> 
    7574                </p> 
    7675                 
    7776                <p> 
    78                         <label for="accesslevel">access level</label><br /> 
    79                         <?php basic_choicelist("accesslevel",$therecord["accesslevel"],array(array("value"=>"-10","name"=>"portal access only"),array("value"=>"10","name"=>"basic user (shipping)"),array("value"=>"20","name"=>"Power User (sales)"),array("value"=>"30","name"=>"Manager (sales manager)"),array("value"=>"50","name"=>"Upper Manager"),array("value"=>"90","name"=>"Administrator")),Array("class"=>"important"));?>                 
     77                        <label for="roleid">access (role)</label><br /> 
     78                        <?php roles_choicelist("roleid",$therecord["roleid"],$dblink)?> 
    8079                </p> 
    8180        </fieldset> 
     
    9493                                <br /> 
    9594                                <input type="radio" id="type1" value="cat" <?php if($therecord["link"]=="") echo "checked" ?> name="radio" onClick="showTypeDetails();"  class="radiochecks" /><label for="type1">category</label><br /> 
    96                                 <img src="menu-example-category.png" width="150" height="72" class="typeImage"> 
     95                                <img src="menu-example-category.png" width="150" height="72" class="typeImage" alt="category" /> 
    9796                        </p> 
    9897                         
     
    10099                                <br /> 
    101100                                <input type="radio" id="type2" value="search" <?php if(strpos($therecord["link"],"search.php?id=")!==false) echo "checked" ?> name="radio" onClick="showTypeDetails();" class="radiochecks" /><label for="type2">table definition search</label><br /> 
    102                                 <img src="menu-example-tabledef.png" width="150" height="72" class="typeImage"> 
     101                                <img src="menu-example-tabledef.png" width="150" height="72" class="typeImage" alt="table definition search" /> 
    103102                        </p> 
    104103 
     
    106105                                <br /> 
    107106                                <input type="radio" id="type3" value="link" <?php if(strpos($therecord["link"],"search.php?id=")===false && $therecord["link"]!="") echo "checked" ?> name="radio" onClick="showTypeDetails();" class="radiochecks" /><label for="type3">page link</label><br /> 
    108                                 <img src="menu-example-link.png" width="150" height="72" class="typeImage"> 
     107                                <img src="menu-example-link.png" width="150" height="72" class="typeImage" alt="page link" /> 
    109108                        </p> 
    110109                </fieldset> 
  • trunk/phpbms/modules/base/notes_addedit.php

    r166 r170  
    264264        </fieldset> 
    265265        <?php include("../../include/createmodifiedby.php"); ?> 
    266         <?php if ($_SESSION["userinfo"]["id"] != $therecord["createdby"] && $therecord["createdby"]!="" && $_SESSION["userinfo"]["id"] != $therecord["assignedtoid"] && $_SESSION["userinfo"]["accesslevel"]<90) 
    267                   echo "<SCRIPT language=\"javascript\">disableSave()</SCRIPT>";?>   
    268266</div> 
    269267<?php include("../../footer.php")?> 
  • trunk/phpbms/modules/base/reports_addedit.php

    r155 r170  
    8080                </p> 
    8181                <p> 
    82                         <label for="accesslevel" >access<br /></label> 
    83                         <?php basic_choicelist("accesslevel",$therecord["accesslevel"],array(array("value"=>"-10","name"=>"portal access only"),array("value"=>"10","name"=>"basic user (shipping)"),array("value"=>"20","name"=>"Power User (sales)"),array("value"=>"30","name"=>"Manager (sales manager)"),array("value"=>"50","name"=>"Upper Manager"),array("value"=>"90","name"=>"Administrator")),Array("class"=>"important","tabindex"=>"30"));?> 
     82                        <label for="roleid" >access (role)</label><br /> 
     83                        <?php roles_choicelist("roleid",$therecord["roleid"],$dblink)?> 
    8484                </p> 
    8585        </fieldset> 
  • trunk/phpbms/modules/base/tabledefs_addedit.php

    r159 r170  
    5555<script language="JavaScript" src="../../common/javascript/fields.js" type="text/javascript"></script> 
    5656<script language="JavaScript" src="../../common/javascript/autofill.js" type="text/javascript"></script> 
     57<script language="JavaScript" src="javascript/tabledefs.js" type="text/javascript"></script> 
    5758</head> 
    5859<body><?php include("../../menu.php")?> 
     
    8182                        <?php autofill("moduleid",$therecord["moduleid"],21,"modules.id","modules.name","concat('v',modules.version)","",Array("size"=>"20","maxlength"=>"32"),true,"Module is requred.") ?>             
    8283                </div> 
    83                 <p> 
    84                         <label for="deletebutton">delete button name</label><br /> 
    85                         <input id="deletebutton" name="deletebutton" type="text" value="<?php echo htmlQuotes($therecord["deletebutton"])?>" size="20" maxlength="20" /><br /> 
    86                 </p> 
    8784        </fieldset> 
    8885 
     
    9289                        <p> 
    9390                                <br /> 
    94                                 <?php field_text("displayname",$therecord["displayname"],1,"Display Name cannot be blank.","",Array("size"=>"40","maxlength"=>"64","class"=>"important")); ?> 
     91                                <?php field_text("displayname",$therecord["displayname"],1,"Display Name cannot be blank.","",Array("size"=>"50","maxlength"=>"64","class"=>"important")); ?> 
    9592                        </p>                             
    9693                </fieldset> 
     
    10097                        <p> 
    10198                                <label for="maintable">primary table name</label><br /> 
    102                                 <?php field_text("maintable",$therecord["maintable"],1,"Primary table name cannot be blank.","",Array("size"=>"32","maxlength"=>"64","class"=>"")); ?> 
     99                                <?php field_text("maintable",$therecord["maintable"],1,"Primary table name cannot be blank.","",Array("size"=>"50","maxlength"=>"64","class"=>"")); ?> 
    103100                        </p> 
    104101                        <p> 
     
    114111                        </p>                     
    115112                </fieldset> 
     113         
     114                <fieldset> 
     115                        <legend>add/edit options</legend> 
     116                        <p> 
     117                                <label for="addfile">add record file</label><br /> 
     118                                <?php field_text("addfile",$therecord["addfile"],1,"Add file name cannot be blank.","",Array("size"=>"100","maxlength"=>"128")); ?><br /> 
     119                                <span class="notes">file name, including path from application root, that is used for creating new records.</span> 
     120                        </p> 
     121                        <p> 
     122                                add access (role)<br /> 
     123                                <?php roles_choicelist("addroleid",$therecord["addroleid"],$dblink)?> 
     124                        </p> 
     125                        <p>&nbsp;</p> 
     126                        <p> 
     127                                <label for="editfile">edit record file </label><br /> 
     128                                <?php field_text("editfile",$therecord["editfile"],1,"Edit file name cannot be blank.","",Array("size"=>"100","maxlength"=>"128")); ?><br /> 
     129                                <span class="notes">file name, including path from application root, that is used for editing existing records.</span>                   
     130                        </p> 
     131                        <p> 
     132                                edit access (role)<br /> 
     133                                <?php roles_choicelist("editroleid",$therecord["editroleid"],$dblink)?> 
     134                        </p> 
     135                </fieldset> 
     136                 
     137                <fieldset> 
     138                        <legend>search screen options</legend> 
     139                        <p> 
     140                                <label for="searchroleid">search access (role)</label><br /> 
     141                                <?php roles_choicelist("searchroleid",$therecord["searchroleid"],$dblink)?> 
     142                        </p> 
     143                        <p> 
     144                                <label for="advsearchroleid">advanced search access (role)</label><br /> 
     145                                <?php roles_choicelist("advsearchroleid",$therecord["advsearchroleid"],$dblink)?>                        
     146                        </p> 
     147                        <p> 
     148                                <label for="viewsqlroleid">view sql access (role)</label><br /> 
     149                                <?php roles_choicelist("viewsqlroleid",$therecord["viewsqlroleid"],$dblink)?> 
     150                        </p> 
     151                        <p> 
     152                                <label for="deletebutton">delete button name</label><br /> 
     153                                <input id="deletebutton" name="deletebutton" type="text" value="<?php echo htmlQuotes($therecord["deletebutton"])?>" size="20" maxlength="20" /><br /> 
     154                        </p>             
     155                        <p> 
     156                                <label for="defaultwhereclause">default search</label> <span class="notes">SQL WHERE clause</span><br /> 
     157                                <textarea id="defaultwhereclause" name="defaultwhereclause" cols="32" rows="4"><?php echo htmlQuotes($therecord["defaultwhereclause"])?></textarea>                      
     158                                <script language="JavaScript" type="text/javascript">requiredArray[requiredArray.length]=new Array('defaultwhereclause','default search cannot be blank.');</script> 
     159                        </p> 
     160                         
     161                        <p> 
     162                                <label for="defaultsortorder">default sort order</label> <span class="notes">SQL ORDER BY clause</span><br /> 
     163                                <textarea id="defaultsortorder" name="defaultsortorder" cols="32" rows="4"><?php echo htmlQuotes($therecord["defaultsortorder"])?></textarea>                    
     164                                <script language="JavaScript" type="text/javascript">requiredArray[requiredArray.length]=new Array('defaultsortorder','default sort order cannot be blank.');</script> 
     165                        </p> 
     166                        <p> 
     167                                Does the default search (above) correspond to a quick search (find drop down) item?<br /> 
     168                                <input type="radio" id="defaultsearchtypeNone" name="defaultsearchtype" class="radiochecks" value="" <?php if($therecord["defaultsearchtype"]=="") echo "checked=\"checked\""?> onchange="toggleDefaultSearch()" /> 
     169                                <label for="defaultsearchtypeNone">no</label>&nbsp; 
     170                                 
     171                                <input type="radio" id="defaultsearchtypeSearch" name="defaultsearchtype" class="radiochecks" value="search" <?php if($therecord["defaultsearchtype"]=="search") echo "checked=\"checked\""?>  onchange="toggleDefaultSearch()" /> 
     172                                <label for="defaultsearchtypeNone">yes</label>&nbsp;                     
     173                        </p> 
     174                        <div id="defaultQuickSearch" <?php if($therecord["defaultsearchtype"]=="") echo "style=\"display:none;\""?>> 
     175                                <p> 
     176                                        <label for="defaultcriteriafindoptions">critera: selected find option</label> <span class="notes">(quick search)</span><br/> 
     177                                        <textarea id="defaultcriteriafindoptions" name="defaultcriteriafindoptions" cols="32" rows="2"><?php echo htmlQuotes($therecord["defaultcriteriafindoptions"])?></textarea> 
     178                                 
     179                                </p> 
     180                                <p> 
     181                                        <label for="defaultcriteriaselection">criteria: selected search field</label><br /> 
     182                                        <textarea id="defaultcriteriaselection" name="defaultcriteriaselection" cols="32" rows="2" ><?php echo htmlQuotes($therecord["defaultcriteriaselection"])?></textarea>           
     183                                </p> 
     184                        </div> 
     185                </fieldset> 
    116186        </div> 
    117          
    118         <fieldset> 
    119                 <legend>file references</legend> 
    120                 <p> 
    121                         <label for="addfile">add new record file name</label><br /> 
    122                         <?php field_text("addfile",$therecord["addfile"],1,"Add file name cannot be blank.","",Array("size"=>"100","maxlength"=>"128")); ?> 
    123                 </p> 
    124                 <p> 
    125                         <label for="editfile">edit record file name</label><br /> 
    126                         <?php field_text("editfile",$therecord["editfile"],1,"Edit file name cannot be blank.","",Array("size"=>"100","maxlength"=>"128")); ?>           
    127                 </p> 
    128                 <p class="notes"> 
    129                         Location of add and edit files, including path from phpBMS root.  In most cases, they should be the same. 
    130                 </p> 
    131         </fieldset> 
    132          
    133         <fieldset> 
    134                 <legend>search/display defaults</legend> 
    135                 <p> 
    136                         <label for="defaultwhereclause">default search</label> <span class="notes">SQL WHERE clause</span><br /> 
    137                         <textarea id="defaultwhereclause" name="defaultwhereclause" cols="32" rows="4"><?php echo htmlQuotes($therecord["defaultwhereclause"])?></textarea>                      
    138                         <script language="JavaScript" type="text/javascript">requiredArray[requiredArray.length]=new Array('defaultwhereclause','default search cannot be blank.');</script> 
    139                 </p> 
    140                  
    141                 <p> 
    142                         <label for="defaultsortorder">default sort order</label> <span class="notes">SQL ORDER BY clause</span><br /> 
    143                         <textarea id="defaultsortorder" name="defaultsortorder" cols="32" rows="4"><?php echo htmlQuotes($therecord["defaultsortorder"])?></textarea>                    
    144                         <script language="JavaScript" type="text/javascript">requiredArray[requiredArray.length]=new Array('defaultsortorder','default sort order cannot be blank.');</script> 
    145                 </p> 
    146                 <p> 
    147                         Is default search a quick search item?<br /> 
    148                         <input type="radio" id="defaultsearchtypeNone" name="defaultsearchtype" class="radiochecks" value="" <?php if($therecord["defaultsearchtype"]=="") echo "checked=\"checked\""?> /> 
    149                         <label for="defaultsearchtypeNone">no</label>&nbsp; 
    150                          
    151                         <input type="radio" id="defaultsearchtypeSearch" name="defaultsearchtype" class="radiochecks" value="search" <?php if($therecord["defaultsearchtype"]=="search") echo "checked=\"checked\""?> /> 
    152                         <label for="defaultsearchtypeNone">yes</label>&nbsp;                     
    153                 </p> 
    154  
    155                 <p> 
    156                         If yes to the above question: 
    157                 </p> 
    158                 <p> 
    159                         <label for="defaultcriteriafindoptions">critera: selected find option</label> <span class="notes">(quick search)</span><br/> 
    160                         <textarea id="defaultcriteriafindoptions" name="defaultcriteriafindoptions" cols="32" rows="4"><?php echo htmlQuotes($therecord["defaultcriteriafindoptions"])?></textarea> 
    161                  
    162                 </p> 
    163                 <p> 
    164                         <label for="defaultcriteriaselection">criteria: selected search field</label><br /> 
    165                         <textarea id="defaultcriteriaselection" name="defaultcriteriaselection" cols="32" rows="4" ><?php echo htmlQuotes($therecord["defaultcriteriaselection"])?></textarea>           
    166                 </p> 
    167         </fieldset> 
    168187         
    169188        <?php include("../../include/createmodifiedby.php"); ?> 
  • trunk/phpbms/modules/base/tabledefs_options.php

    r160 r170  
    115115         <th nowrap align="left">name</th> 
    116116         <th nowrap align="left">option / function</th> 
    117          <th nowrap align="center">restricted</th> 
     117         <th nowrap align="center">access</th> 
    118118         <th nowrap>&nbsp;</th> 
    119119        </tr> 
     
    139139                } 
    140140        ?></td> 
    141          <td nowrap align="center"><?php if ($therecord["accesslevel"]>10) echo "X"; else echo "&middot;";?></td>        
     141         <td nowrap align="center"><?php displayRights($therecord["roleid"],$therecord["rolename"])?></td>       
    142142          
    143143         <td nowrap valign="top"> 
     
    191191                        </div> 
    192192                        <p> 
    193                                 <label for="accesslevel">access level</label><br /> 
    194                                 <?php basic_choicelist("accesslevel",$theoption["accesslevel"],array(array("value"=>"-10","name"=>"portal access only"),array("value"=>"10","name"=>"basic user (shipping)"),array("value"=>"20","name"=>"Power User (sales)"),array("value"=>"30","name"=>"Manager (sales manager)"),array("value"=>"50","name"=>"Upper Manager"),array("value"=>"90","name"=>"Administrator")),Array("class"=>"important"));?>                         
     193                                <label for="roleid">access (role)</label><br /> 
     194                                <?php roles_choicelist("roleid",$theoption["roleid"],$dblink)?>                          
    195195                        </p> 
    196196 
  • trunk/phpbms/modules/base/tabledefs_quicksearch.php

    r160 r170  
    104104                         <th nowrap align="left">Name</th> 
    105105                         <th width="100%" nowrap align="left">Search</th> 
    106                          <th width="100%" nowrap class="queryheader" align="left">Access Level</th> 
     106                         <th width="100%" nowrap class="queryheader" align="left">Access</th> 
    107107                         <th nowrap>&nbsp;</th> 
    108108                </tr> 
     
    122122         <td nowrap valign="top"><strong><?php echo htmlQuotes($therecord["name"])?></strong></td> 
    123123         <td valign="top" class="small"><?php echo htmlQuotes($therecord["search"])?></td> 
    124          <td valign="top" align=center class="small"><?php echo htmlQuotes($therecord["accesslevel"])?></td> 
     124         <td valign="top" align=center class="small" nowrap><?php echo displayRights($therecord["roleid"],$therecord["rolename"])?></td> 
    125125         <td nowrap valign="top"> 
    126126                 <button id="edit<?php echo $therecord["id"]?>" type="button" onclick="document.location='<?php echo $_SERVER["PHP_SELF"]."?id=".$_GET["id"]."&amp;command=edit&amp;quicksearchid=".$therecord["id"]?>';" class="graphicButtons buttonEdit"><span>edit</span></button> 
     
    148148                </p> 
    149149                <p> 
    150                         <label for="accesslevel">access level</label><br /> 
    151                         <?php basic_choicelist("accesslevel",$thequicksearch["accesslevel"],array(array("value"=>"-10","name"=>"portal access only"),array("value"=>"10","name"=>"basic user (shipping)"),array("value"=>"20","name"=>"Power User (sales)"),array("value"=>"30","name"=>"Manager (sales manager)"),array("value"=>"50","name"=>"Upper Manager"),array("value"=>"90","name"=>"Administrator")));?> 
     150                        <label for="roleid">access (role)</label><br /> 
     151                        <?php roles_choicelist("roleid",$thequicksearch["roleid"],$dblink)?>     
    152152                </p> 
    153153                <p> 
  • trunk/phpbms/modules/base/usersearches_edit.php

    r157 r170  
    9090                <?php } else {?> 
    9191                <p> 
    92                         <label for="accesslevel">access level</label><br /> 
    93                         <?php basic_choicelist("accesslevel",$therecord["accesslevel"],array(array("value"=>"-10","name"=>"portal access only"),array("value"=>"10","name"=>"basic user (shipping)"),array("value"=>"20","name"=>"Power User (sales)"),array("value"=>"30","name"=>"Manager (sales manager)"),array("value"=>"50","name"=>"Upper Manager"),array("value"=>"90","name"=>"Administrator")),Array("class"=>"important"));?> 
     92                        <label for="roleid">access (role)</label><br /> 
     93                        <?php roles_choicelist("roleid",$therecord["roleid"],$dblink)?> 
    9494                </p> 
    9595                <?php } ?> 
  • trunk/phpbms/modules/base/users_addedit.php

    r155 r170  
    5454<script language="JavaScript" src="../../common/javascript/fields.js" type="text/javascript"></script> 
    5555<script language="JavaScript" src="../../common/javascript/choicelist.js" type="text/javascript"></script> 
    56 <script language="JavaScript" type="text/javascript"> 
    57         function checkPassword(theform){ 
    58                 if(theform["password"].value!=theform["password2"].value && theform["command"].value!="cancel"){ 
    59                         alert("Passwords did not match."); 
    60                         return false; 
    61                 } 
    62                 return true; 
    63         } 
    64 </script> 
     56<script language="JavaScript" src="javascript/users.js" type="text/javascript"></script> 
    6557</head> 
    6658<body><?php include("../../menu.php")?> 
    67 <form action="<?php echo $_SERVER["REQUEST_URI"] ?>" method="post" name="record" onSubmit="return (validateForm(this) &amp;&amp; checkPassword(this));"><div id="dontSubmit"><input type="submit" value=" " onClick="return false;" /></div> 
     59<form action="<?php echo $_SERVER["REQUEST_URI"] ?>" method="post" name="record" onSubmit="return submitForm(this);"><div id="dontSubmit"><input type="submit" value=" " onClick="return false;" /></div> 
    6860<div class="bodyline"> 
    6961        <div id="topButtons"><?php showSaveCancel(1); ?></div> 
     
    7870                </p> 
    7971 
    80                 <p>              
    81                         <label for="accesslevel" class="important">access level</label><br /> 
    82                         <?php basic_choicelist("accesslevel",$therecord["accesslevel"],array(array("value"=>"-10","name"=>"portal access only"),array("value"=>"10","name"=>"basic user (shipping)"),array("value"=>"20","name"=>"Power User (sales)"),array("value"=>"30","name"=>"Manager (sales manager)"),array("value"=>"50","name"=>"Upper Manager"),array("value"=>"90","name"=>"Administrator")),Array("class"=>"important"));?>                 
     72                <p><?php field_checkbox("admin",$therecord["admin"])?><label for="admin">administrator</label></p> 
     73                 
     74 
     75                <p><?php field_checkbox("revoked",$therecord["revoked"])?><label for="revoked">revoke access</label></p>                 
     76 
     77                <p> 
     78                        <?php field_checkbox("portalaccess",$therecord["portalaccess"])?><label for="admin">portal access</label><br /> 
     79                        <span class="notes"> 
     80                                user accounts marked as portal access cannot login to phpBMS, but are used by external applications 
     81                                when creating/modifiying information from outside the application for recording purposes. 
     82                        </span> 
    8383                </p> 
    84                  
    85                 <p><?php field_checkbox("revoked",$therecord["revoked"])?><label for="revoked">revoke access</label></p>                 
    8684        </fieldset> 
    8785         
     
    141139                        </p> 
    142140                </fieldset> 
     141                <?php if($therecord["id"]){?> 
     142                <fieldset> 
     143                        <legend>roles</legend> 
     144                        <input type="hidden" name="roleschanged" id="roleschanged" value="0" /> 
     145                        <input type="hidden" name="newroles" id="newroles" value="" /> 
     146                        <div class="fauxP"> 
     147                        <div id="assignedrolesdiv"> 
     148                                assigned roles<br /> 
     149                                <select id="assignedroles" size="10" multiple> 
     150                                        <?php displayRoles($therecord["id"],"assigned",$dblink)?> 
     151                                </select> 
     152                        </div> 
     153                        <div id="rolebuttonsdiv"> 
     154                                <p> 
     155                                        <button type="button" class="Buttons" onclick="moveRole('availableroles','assignedroles')">&lt; add role</button> 
     156                                </p> 
     157                                <p> 
     158                                        <button type="button" class="Buttons" onclick="moveRole('assignedroles','availableroles')">remove role &gt;</button> 
     159                                </p> 
     160                        </div> 
     161                        <div id="availablerolesdiv"> 
     162                                available roles<br /> 
     163                                <select id="availableroles" size="10" multiple> 
     164                                        <?php displayRoles($therecord["id"],"available",$dblink)?> 
     165                                </select> 
     166                        </div> 
     167                        </div> 
     168                </fieldset>              
     169                <?php }?> 
    143170        </div>   
    144171 
  • trunk/phpbms/modules/bms/clients_attachments.php

    r145 r170  
    4848        $tabledefid=2; 
    4949        $refid=(integer) $_GET["refid"]; 
    50         $whereclause="attachments.tabledefid=".$tabledefid." AND attachments.recordid=".$refid." AND files.accesslevel<=".$_SESSION["userinfo"]["accesslevel"]; 
     50 
     51        $securitywhere=""; 
     52        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0) 
     53                $securitywhere=" AND files.roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)"; 
     54 
     55        $whereclause="attachments.tabledefid=".$tabledefid." AND attachments.recordid=".$refid.$securitywhere; 
    5156        $backurl="../bms/clients_attachments.php"; 
    5257        $base="../../"; 
  • trunk/phpbms/modules/bms/include/clientemailprojects_edit_include.php

    r166 r170  
    3838*/ 
    3939 
    40 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     40 
    4141function getEmailInfo($id){ 
    4242        global $dblink; 
     
    131131//================================================================== 
    132132if(!isset($_POST["command"])){ 
    133         if(isset($_GET["id"])) 
     133        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     134        $tableresult=mysql_query($querystatement,$dblink); 
     135        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     136        $tablerecord=mysql_fetch_array($tableresult); 
     137         
     138        if(isset($_GET["id"])){ 
     139                //editing 
     140                if(!hasRights($tablerecord["editroleid"])) 
     141                        goURL($_SESSION["app_path"]."noaccess.php"); 
    134142                $therecord=getRecords((integer) $_GET["id"]); 
    135         else 
     143        } else { 
     144                if(!hasRights($tablerecord["addroleid"])) 
     145                        goURL($_SESSION["app_path"]."noaccess.php"); 
    136146                $therecord=setRecordDefaults(); 
     147        } 
    137148        $username=getUserName($therecord["userid"]); 
    138149        if(!$username) $username="global"; 
  • trunk/phpbms/modules/bms/include/clientemailprojects_search_functions.php

    r166 r170  
    4141//functions 
    4242//============================================= 
    43 if($_SESSION["userinfo"]["accesslevel"]<90) goURL($_SESSION["app_path"]."noaccess.html"); 
     43 
    4444 
    4545//delete 
  • trunk/phpbms/modules/bms/include/clients_addedit_include.php

    r166 r170  
    285285//================================================================== 
    286286if(!isset($_POST["command"])){ 
    287         if(isset($_GET["id"])) 
     287        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     288        $tableresult=mysql_query($querystatement,$dblink); 
     289        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     290        $tablerecord=mysql_fetch_array($tableresult); 
     291         
     292        if(isset($_GET["id"])){ 
     293                //editing 
     294                if(!hasRights($tablerecord["editroleid"])) 
     295                        goURL($_SESSION["app_path"]."noaccess.php"); 
    288296                $therecord=getRecords((integer) $_GET["id"]); 
    289         else 
     297        } else { 
     298                if(!hasRights($tablerecord["addroleid"])) 
     299                        goURL($_SESSION["app_path"]."noaccess.php"); 
    290300                $therecord=setRecordDefaults(); 
     301        } 
    291302        $createdby=getUserName($therecord["createdby"]); 
    292303        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/bms/include/discounts_addedit_include.php

    r166 r170  
    179179//================================================================== 
    180180if(!isset($_POST["command"])){ 
    181         if(isset($_GET["id"])) 
     181        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     182        $tableresult=mysql_query($querystatement,$dblink); 
     183        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     184        $tablerecord=mysql_fetch_array($tableresult); 
     185         
     186        if(isset($_GET["id"])){ 
     187                //editing 
     188                if(!hasRights($tablerecord["editroleid"])) 
     189                        goURL($_SESSION["app_path"]."noaccess.php"); 
    182190                $therecord=getRecords((integer) $_GET["id"]); 
    183         else 
     191        } else { 
     192                if(!hasRights($tablerecord["addroleid"])) 
     193                        goURL($_SESSION["app_path"]."noaccess.php"); 
    184194                $therecord=setRecordDefaults(); 
     195        } 
    185196        $stats=getTotals($therecord["id"]); 
    186197        $createdby=getUserName($therecord["createdby"]); 
  • trunk/phpbms/modules/bms/include/invoices_addedit_include.php

    r166 r170  
    318318                        $querystatement.="trackingno=\"".$variables["trackingno"]."\", ";  
    319319 
    320                         if($_SESSION["userinfo"]["accesslevel"]>=20){ 
     320                        if(hasRights(20)){ 
    321321                                $querystatement.="paymentmethod=\"".$variables["paymentmethod"]."\", ";  
    322322                                $querystatement.="checkno=\"".$variables["checkno"]."\", ";  
     
    495495 
    496496if(!isset($_POST["command"])){ 
     497        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     498        $tableresult=mysql_query($querystatement,$dblink); 
     499        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     500        $tablerecord=mysql_fetch_array($tableresult); 
     501         
    497502        if(isset($_GET["id"])){ 
     503                //editing 
     504                if(!hasRights($tablerecord["editroleid"])) 
     505                        goURL($_SESSION["app_path"]."noaccess.php"); 
    498506                $therecord=getRecords((integer) $_GET["id"]); 
    499                 //invoice specific 
     507        } else { 
     508                if(!hasRights($tablerecord["addroleid"])) 
     509                        goURL($_SESSION["app_path"]."noaccess.php"); 
     510                $therecord=setRecordDefaults(); 
    500511        } 
    501         else 
    502                 $therecord=setRecordDefaults(); 
    503512        $createdby=getUserName($therecord["createdby"]); 
    504513        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/bms/include/productcategories_addedit_include.php

    r166 r170  
    136136//================================================================== 
    137137if(!isset($_POST["command"])){ 
    138         if(isset($_GET["id"])) 
     138        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     139        $tableresult=mysql_query($querystatement,$dblink); 
     140        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     141        $tablerecord=mysql_fetch_array($tableresult); 
     142         
     143        if(isset($_GET["id"])){ 
     144                //editing 
     145                if(!hasRights($tablerecord["editroleid"])) 
     146                        goURL($_SESSION["app_path"]."noaccess.php"); 
    139147                $therecord=getRecords((integer) $_GET["id"]); 
    140         else 
     148        } else { 
     149                if(!hasRights($tablerecord["addroleid"])) 
     150                        goURL($_SESSION["app_path"]."noaccess.php"); 
    141151                $therecord=setRecordDefaults(); 
     152        } 
    142153        $createdby=getUserName($therecord["createdby"]); 
    143154        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/bms/include/products_addedit_include.php

    r166 r170  
    119119         
    120120        $querystatement="UPDATE products SET "; 
    121                 if($_SESSION["userinfo"]["accesslevel"]>=20){ 
     121                if(hasRights(20)){ 
    122122                        $querystatement.="partnumber=\"".$variables["partnumber"]."\", ";  
    123123                        $querystatement.="partname=\"".$variables["partname"]."\", ";  
     
    148148                $querystatement.="packagesperitem=".$variables["packagesperitem"].", ";  
    149149 
    150                 if($_SESSION["userinfo"]["accesslevel"]>=20){ 
     150                if(hasRights(20)){ 
    151151                        if(isset($variables["webenabled"])) $querystatement.="webenabled=1, "; else $querystatement.="webenabled=0, "; 
    152152 
     
    186186                                } 
    187187                        } 
    188                 }//end accesslevel check 
     188                }//end access check 
    189189 
    190190        //==== Almost all records should have this ========= 
     
    298298//================================================================== 
    299299if(!isset($_POST["command"])){ 
    300         if(isset($_GET["id"])) 
     300        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     301        $tableresult=mysql_query($querystatement,$dblink); 
     302        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     303        $tablerecord=mysql_fetch_array($tableresult); 
     304         
     305        if(isset($_GET["id"])){ 
     306                //editing 
     307                if(!hasRights($tablerecord["editroleid"])) 
     308                        goURL($_SESSION["app_path"]."noaccess.php"); 
    301309                $therecord=getRecords((integer) $_GET["id"]); 
    302         else 
     310        } else { 
     311                if(!hasRights($tablerecord["addroleid"])) 
     312                        goURL($_SESSION["app_path"]."noaccess.php"); 
    303313                $therecord=setRecordDefaults(); 
     314        } 
    304315        $createdby=getUserName($therecord["createdby"]); 
    305316        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/bms/include/products_functions.php

    r145 r170  
    6464        ); 
    6565         
    66         if($_SESSION["userinfo"]["accesslevel"]>=30){ 
     66        if(hasRights(30)){ 
    6767                array_push($thetabs,array( 
    6868                        "name"=>"Sales History", 
  • trunk/phpbms/modules/bms/include/tax_addedit_include.php

    r166 r170  
    131131//================================================================== 
    132132if(!isset($_POST["command"])){ 
    133         if(isset($_GET["id"])) 
     133        $querystatement="SELECT addroleid,editroleid FROM tabledefs WHERE id=".$tableid; 
     134        $tableresult=mysql_query($querystatement,$dblink); 
     135        if(!$tableresult) reportError(200,"Could Not retrieve Table Definition for id ".$tableid); 
     136        $tablerecord=mysql_fetch_array($tableresult); 
     137         
     138        if(isset($_GET["id"])){ 
     139                //editing 
     140                if(!hasRights($tablerecord["editroleid"])) 
     141                        goURL($_SESSION["app_path"]."noaccess.php"); 
    134142                $therecord=getRecords((integer) $_GET["id"]); 
    135         else 
     143        } else { 
     144                if(!hasRights($tablerecord["addroleid"])) 
     145                        goURL($_SESSION["app_path"]."noaccess.php"); 
    136146                $therecord=setRecordDefaults(); 
     147        } 
    137148        $createdby=getUserName($therecord["createdby"]); 
    138149        $modifiedby=getUserName($therecord["modifiedby"]); 
  • trunk/phpbms/modules/bms/install/choices.sql

    r145 r170  
    1 INSERT INTO choices VALUES (128,'leadsource','Search Engine'); 
    2 INSERT INTO choices VALUES (127,'leadsource','Referral'); 
    3 INSERT INTO choices VALUES (106,'department','sales'); 
    4 INSERT INTO choices VALUES (126,'leadsource','Other'); 
    5 INSERT INTO choices VALUES (125,'leadsource','Internet'); 
    6 INSERT INTO choices VALUES (124,'leadsource','Friend'); 
    7 INSERT INTO choices VALUES (123,'leadsource','Book'); 
    8 INSERT INTO choices VALUES (210,'paymentmethod','Personal Check'); 
    9 INSERT INTO choices VALUES (209,'paymentmethod','Money Order'); 
    10 INSERT INTO choices VALUES (208,'paymentmethod','Master Card'); 
    11 INSERT INTO choices VALUES (207,'paymentmethod','Discover Card'); 
    12 INSERT INTO choices VALUES (206,'paymentmethod','Cashiers Check'); 
    13 INSERT INTO choices VALUES (211,'paymentmethod','VISA'); 
    14 INSERT INTO choices VALUES (212,'paymentmethod','VISA - Debit'); 
    15 INSERT INTO choices VALUES (213,'paymentmethod','Cash'); 
    16 INSERT INTO choices VALUES (204,'paymentmethod',''); 
    17 INSERT INTO choices VALUES (121,'shippingmethod','UPS Ground (Res)'); 
    18 INSERT INTO choices VALUES (122,'shippingmethod','UPS Next Day Air'); 
    19 INSERT INTO choices VALUES (120,'shippingmethod','UPS Ground (Com)'); 
    20 INSERT INTO choices VALUES (119,'shippingmethod','UPS 3 Day Select'); 
    21 INSERT INTO choices VALUES (117,'shippingmethod','FedEx Standard Overnight'); 
    22 INSERT INTO choices VALUES (205,'paymentmethod','American Express'); 
    23 INSERT INTO choices VALUES (118,'shippingmethod','UPS 2nd Day Air'); 
    24 INSERT INTO choices VALUES (116,'shippingmethod','FedEx Priority Overnight AM'); 
    25 INSERT INTO choices VALUES (115,'shippingmethod',''); 
     1INSERT INTO choices VALUES (101,'leadsource','Search Engine'); 
     2INSERT INTO choices VALUES (102,'leadsource','Referral'); 
     3INSERT INTO choices VALUES (103,'department','sales'); 
     4INSERT INTO choices VALUES (104,'leadsource','Other'); 
     5INSERT INTO choices VALUES (105,'leadsource','Internet'); 
     6INSERT INTO choices VALUES (106,'leadsource','Friend'); 
     7INSERT INTO choices VALUES (107,'leadsource','Book'); 
     8INSERT INTO choices VALUES (108,'paymentmethod','Personal Check'); 
     9INSERT INTO choices VALUES (109,'paymentmethod','Money Order'); 
     10INSERT INTO choices VALUES (110,'paymentmethod','Master Card'); 
     11INSERT INTO choices VALUES (111,'paymentmethod','Discover Card'); 
     12INSERT INTO choices VALUES (112,'paymentmethod','Cashiers Check'); 
     13INSERT INTO choices VALUES (113,'paymentmethod','VISA'); 
     14INSERT INTO choices VALUES (114,'paymentmethod','VISA - Debit'); 
     15INSERT INTO choices VALUES (115,'paymentmethod','Cash'); 
     16INSERT INTO choices VALUES (116,'paymentmethod',''); 
     17INSERT INTO choices VALUES (117,'shippingmethod','UPS Ground (Res)'); 
     18INSERT INTO choices VALUES (118,'shippingmethod','UPS Next Day Air'); 
     19INSERT INTO choices VALUES (119,'shippingmethod','UPS Ground (Com)'); 
     20INSERT INTO choices VALUES (120,'shippingmethod','UPS 3 Day Select'); 
     21INSERT INTO choices VALUES (121,'shippingmethod','FedEx Standard Overnight'); 
     22INSERT INTO choices VALUES (122,'paymentmethod','American Express'); 
     23INSERT INTO choices VALUES (123,'shippingmethod','UPS 2nd Day Air'); 
     24INSERT INTO choices VALUES (124,'shippingmethod','FedEx Priority Overnight AM'); 
     25INSERT INTO choices VALUES (125,'shippingmethod',''); 
  • trunk/phpbms/modules/bms/install/menu.sql

    r145 r170  
    1 INSERT INTO menu VALUES (1,'Clients/Prospects','search.php?id=2',2,10,2,2,'0000-00-00 00:00:00',20051012120056,10); 
    2 INSERT INTO menu VALUES (2,'Client','',0,0,2,2,'0000-00-00 00:00:00',20051021174922,20); 
    3 INSERT INTO menu VALUES (3,'Check for Duplicates','search.php?id=18',2,20,2,2,'0000-00-00 00:00:00',20051012120049,10); 
    4 INSERT INTO menu VALUES (6,'Sales','',0,1,2,2,'2004-04-08 14:17:54',20051012120012,10); 
    5 INSERT INTO menu VALUES (7,'Orders/Invoices','search.php?id=3',6,0,2,2,'2004-04-08 14:19:54',20051012120012,10); 
    6 INSERT INTO menu VALUES (8,'Item Analysis','search.php?id=5',6,1,2,2,'2004-04-08 14:28:35',20051006194014,30); 
    7 INSERT INTO menu VALUES (9,'Tax Areas','search.php?id=6',6,20,2,2,'2004-04-08 14:28:55',20051021175119,50); 
    8 INSERT INTO menu VALUES (10,'Product','',0,2,2,2,'2004-04-08 14:29:20',20051012120012,10); 
    9 INSERT INTO menu VALUES (11,'Products','search.php?id=4',10,0,2,2,'2004-04-08 14:29:46',20051012120012,10); 
    10 INSERT INTO menu VALUES (12,'Product Categories','search.php?id=7',10,1,2,2,'2004-04-08 14:30:02',20051021175150,30); 
    11 INSERT INTO menu VALUES (13,'Prerequisites','search.php?id=8',10,2,2,2,'2004-04-08 14:30:21',20051021175206,20); 
    12 INSERT INTO menu VALUES (21,'Quick View','modules/bms/quickview.php',2,0,2,2,'2005-10-12 11:58:55',20051012204127,20); 
    13 INSERT INTO menu VALUES (23,'Discounts/Promotions','search.php?id=25',6,10,2,2,'2005-10-20 17:42:55',20051021175020,30); 
     1INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (200,'Client','',0,0,1,1,NOW(),NOW(),20); 
     2INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (201,'Quick View','modules/bms/quickview.php',200,0,1,1,NOW(),NOW(),20); 
     3INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (202,'Clients/Prospects','search.php?id=2',200,10,1,1,NOW(),NOW(),10); 
     4INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (203,'Check for Duplicates','search.php?id=18',200,20,1,1,NOW(),NOW(),10); 
     5INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (204,'Sales','',0,1,1,1,NOW(),NOW(),10); 
     6INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (205,'Orders/Invoices','search.php?id=3',204,0,1,1,NOW(),NOW(),10); 
     7INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (206,'Item Analysis','search.php?id=5',204,1,1,1,NOW(),NOW(),30); 
     8INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (207,'Discounts/Promotions','search.php?id=25',204,10,1,1,NOW(),NOW(),30); 
     9INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (208,'Tax Areas','search.php?id=6',204,20,1,1,NOW(),NOW(),50); 
     10INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (209,'Product','',0,2,1,1,NOW(),NOW(),10); 
     11INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (210,'Products','search.php?id=4',209,0,1,1,NOW(),NOW(),10); 
     12INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (211,'Product Categories','search.php?id=7',209,1,1,1,NOW(),NOW(),30); 
     13INSERT INTO `menu` (`id`, `name`, `link`, `parentid`, `displayorder`, `createdby`, `modifiedby`, `creationdate`, `modifieddate`, `roleid`) VALUES (212,'Prerequisites','search.php?id=8',209,2,1,1,NOW(),NOW(),20); 
  • trunk/phpbms/modules/bms/install/relationships.sql

    r145 r170  
    1 INSERT INTO relationships VALUES (1,'id','sales managers','salesmanagerid',2,9,2,'2004-04-09 15:11:47',2,20040413103005,0); 
    2 INSERT INTO relationships VALUES (4,'clientid','invoices','id',2,3,2,'2004-04-09 15:30:34',2,20040413103005,1); 
    3 INSERT INTO relationships VALUES (5,'id','clients','clientid',3,2,2,'2004-04-10 13:20:37',2,20040413103005,0); 
    4 INSERT INTO relationships VALUES (6,'id','tax areas','taxareaid',3,6,2,'2004-04-10 13:33:27',2,20040413103005,0); 
    5 INSERT INTO relationships VALUES (7,'id','invoices','invoiceid',5,3,2,'2004-04-10 13:34:11',2,20040413103005,0); 
    6 INSERT INTO relationships VALUES (8,'id','products','productid',5,4,2,'2004-04-10 13:34:53',2,20040413103005,0); 
    7 INSERT INTO relationships VALUES (9,'id','parent products','parentid',8,4,2,'2004-04-10 13:36:24',2,20040413103005,0); 
    8 INSERT INTO relationships VALUES (10,'id','child products','childid',8,4,2,'2004-04-10 13:36:50',2,20040413103005,0); 
    9 INSERT INTO relationships VALUES (11,'categoryid','products','id',7,4,2,'2004-04-10 13:37:27',2,20040413103005,1); 
    10 INSERT INTO relationships VALUES (12,'productid','invoice line items','id',4,5,2,'2004-04-10 13:37:58',2,20040413103005,1); 
    11 INSERT INTO relationships VALUES (13,'parentid','prerequisites','id',4,8,2,'2004-04-10 13:39:16',2,20040413103005,1); 
    12 INSERT INTO relationships VALUES (14,'taxareaid','invoices','id',6,3,2,'2004-04-10 13:39:43',2,20040413103005,0); 
    13 INSERT INTO relationships VALUES (15,'salesmanagerid','sales manager for clients','id',9,2,2,'2004-04-10 13:40:31',2,20040413103005,0); 
    14 INSERT INTO relationships VALUES (16,'createdby','created clients','id',9,2,2,'2004-04-10 13:41:06',2,20040413103005,0); 
    15 INSERT INTO relationships VALUES (17,'modifiedby','modified clients','id',9,2,2,'2004-04-10 13:41:21',2,20040413103005,0); 
    16 INSERT INTO relationships VALUES (18,'createdby','created invoices','id',9,3,2,'2004-04-10 13:41:34',2,20040413103005,0); 
    17 INSERT INTO relationships VALUES (19,'modifiedby','modified invoices','id',9,3,2,'2004-04-10 13:41:52',2,20040413103005,0); 
    18 INSERT INTO relationships VALUES (20,'invoiceid','line items','id',3,5,2,'2004-04-10 13:45:08',2,20050330111955,1); 
    19 INSERT INTO relationships VALUES (21,'discountid','Invoices','id',25,3,2,'2005-10-21 19:22:00',2,20051021192200,0); 
    20 INSERT INTO relationships VALUES (22,'id','Discounts','discountid',3,25,2,'2005-10-21 19:22:33',2,20051021192233,0); 
     1INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (1,'id','sales managers','salesmanagerid',2,9,1,NOW(),1,NOW(),0); 
     2INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (4,'clientid','invoices','id',2,3,1,NOW(),1,NOW(),1); 
     3INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (5,'id','clients','clientid',3,2,1,NOW(),1,NOW(),0); 
     4INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (6,'id','tax areas','taxareaid',3,6,1,NOW(),1,NOW(),0); 
     5INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (7,'id','invoices','invoiceid',5,3,1,NOW(),1,NOW(),0); 
     6INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (8,'id','products','productid',5,4,1,NOW(),1,NOW(),0); 
     7INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (9,'id','parent products','parentid',8,4,1,NOW(),1,NOW(),0); 
     8INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (10,'id','child products','childid',8,4,1,NOW(),1,NOW(),0); 
     9INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (11,'categoryid','products','id',7,4,1,NOW(),1,NOW(),1); 
     10INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (12,'productid','invoice line items','id',4,5,1,NOW(),1,NOW(),1); 
     11INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (13,'parentid','prerequisites','id',4,8,1,NOW(),1,NOW(),1); 
     12INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (14,'taxareaid','invoices','id',6,3,1,NOW(),1,NOW(),0); 
     13INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (15,'salesmanagerid','sales manager for clients','id',9,2,1,NOW(),1,NOW(),0); 
     14INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (16,'createdby','created clients','id',9,2,1,NOW(),1,NOW(),0); 
     15INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (17,'modifiedby','modified clients','id',9,2,1,NOW(),1,NOW(),0); 
     16INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (18,'createdby','created invoices','id',9,3,1,NOW(),1,NOW(),0); 
     17INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (19,'modifiedby','modified invoices','id',9,3,1,NOW(),1,NOW(),0); 
     18INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (20,'invoiceid','line items','id',3,5,1,NOW(),1,NOW(),1); 
     19INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (21,'discountid','Invoices','id',25,3,1,NOW(),1,NOW(),0); 
     20INSERT INTO `relationships` (`id`, `tofield`, `name`, `fromfield`, `fromtableid`, `totableid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`, `inherint`) VALUES (22,'id','Discounts','discountid',3,25,1,NOW(),1,NOW(),0); 
  • trunk/phpbms/modules/bms/install/reports.sql

    r145 r170  
    1 INSERT INTO reports VALUES ('This report will gerneate and display an invoice in PDF format (which can be printed or saved).  The PDF file will contain one page per invoice.',6,'Invoice','modules/bms/report/invoices_pdfinvoice.php','PDF Report',2,'2003-01-29 09:26:05',2,20050330124703,3,100,0); 
    2 INSERT INTO reports VALUES ('This report will gerneate and display a work order  in PDF format (which can be printed or saved).  The PDF file will contain one page per work order.',7,'Work Order','modules/bms/report/invoices_pdfworkorder.php','PDF Report',2,'2003-02-10 15:42:07',2,20051011112615,3,100,20); 
    3 INSERT INTO reports VALUES ('This report will gerneate and display an invoice packing list in PDF format (which can be printed or saved).  The PDF file will contain one page per invoice packing list.',8,'Packing List','modules/bms/report/invoices_pdfpackinglist.php','PDF Report',2,'2003-02-11 13:44:12',2,20050330124732,3,100,0); 
    4 INSERT INTO reports VALUES ('Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',9,'Labels - Folder','modules/bms/report/clients_folderlabels.php','PDF Report',2,'2003-02-28 10:48:49',2,20050403144824,2,50,0); 
    5 INSERT INTO reports VALUES ('Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',12,'Labels - Mailing','modules/bms/report/clients_mailinglabels.php','PDF Report',2,'2005-02-17 13:38:47',2,20050403144831,2,50,0); 
    6 INSERT INTO reports VALUES ('Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',13,'Labels - Shipping','modules/bms/report/clients_shippinglabels.php','PDF Report',2,'2005-02-17 15:41:37',2,20050403141925,2,50,0); 
    7 INSERT INTO reports VALUES ('Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',14,'Labels - Shipping','modules/bms/report/invoices_shippinglabels.php','PDF Report',2,'2005-02-18 10:54:55',2,20050403144840,3,60,0); 
    8 INSERT INTO reports VALUES ('Creater your own custom invoice totaling report, specify groupings, totals, averages and whether to display summary, invoice, and invoice detail information.',15,'Totals - Custom','modules/bms/report/invoices_totals.php','report',2,'2005-02-25 10:51:11',2,20051006113147,3,50,30); 
    9 INSERT INTO reports VALUES ('Basic totals report. Shows invoice total, subtotal and amount due fields  and displaying indidivdual invoice information.',16,'Totals - Amt. w/  Invoices','modules/bms/report/invoices_totals_amtwinv.php','report',2,'2005-03-30 13:01:24',2,20051006113047,3,50,30); 
    10 INSERT INTO reports VALUES ('Basic totals report. Shows invoice total, subtotal and amount due fields  and displaying indidivdual invoice and line item information.',17,'Totals - Amt. w/ Invoices + Line Items','modules/bms/report/invoices_totals_amtwinvlineitems.php','report',2,'2005-03-30 13:02:30',2,20051006113059,3,50,30); 
    11 INSERT INTO reports VALUES ('Totals report grouping by client account manager',18,'Totals - Grouped by Acct. Manager','modules/bms/report/invoices_totals_acctmngers.php','report',2,'2005-03-30 16:26:07',2,20051006113147,3,50,30); 
    12 INSERT INTO reports VALUES ('Totals report including shipping ammount grouped by shipping method',20,'Totals - Grouped by Shipping Method','modules/bms/report/invoices_totals_shippingmethod.php','report',2,'2005-03-30 17:47:51',2,20051006113147,3,50,30); 
    13 INSERT INTO reports VALUES ('Totals report grouped by payment method.',21,'Totals - Grouped by Payment Method','modules/bms/report/invoices_totals_payment.php','report',2,'2005-03-30 17:50:49',2,20051006113147,3,50,30); 
    14 INSERT INTO reports VALUES ('Totals - Grouped by invoice lead source',22,'Totals - Grouped by Invoice Lead Source','modules/bms/report/invoices_totals_leadsource.php','report',2,'2005-03-30 17:53:41',2,20051006113147,3,50,30); 
    15 INSERT INTO reports VALUES ('PDF report for quote.  Does not include amount due.',23,'Quote','modules/bms/report/invoices_pdfquote.php','PDF Report',2,'2005-03-30 17:58:55',2,20051011112828,3,100,20); 
    16 INSERT INTO reports VALUES ('Sales History for product including costs, average price and quantities.',24,'Sales History','modules/bms/report/products_saleshistory.php','report',2,'2005-03-31 10:28:04',2,20051006113218,4,100,30); 
    17 INSERT INTO reports VALUES ('Client purchase history',25,'Purchase History','modules/bms/report/clients_purchasehistory.php','report',2,'2005-03-31 14:24:39',2,20050331142502,2,10,0); 
    18 INSERT INTO reports VALUES ('Creater your own custom line item  totaling report, specify groupings, totals, averages and whether to display summary, invoice, and invoice detail information.',26,'Totals - Custom','modules/bms/report/lineitems_totals.php','report',2,'2005-03-31 16:08:46',2,20051006113147,5,50,30); 
    19 INSERT INTO reports VALUES ('Totals report grouped first by product category and then by product.',27,'Totals - Product Categories','modules/bms/report/lineitems_totals_productcategories.php','report',2,'2005-03-31 17:18:23',2,20051006113147,5,50,30); 
    20 INSERT INTO reports VALUES ('Totals report grouped by product displaying line items',28,'Totals - Product','modules/bms/report/lineitems_totals_products.php','report',2,'2005-03-31 17:25:34',2,20051006113147,5,50,30); 
    21 INSERT INTO reports VALUES ('Totals grouped by invoice lead source and product',29,'Totals - Lead Source','modules/bms/report/lineitems_totals_leadsource.php','report',2,'2005-03-31 17:31:29',2,20051006113147,5,50,30); 
    22 INSERT INTO reports VALUES ('Print all notes associated with the client and any notes associated with client invoices.',30,'Client Notes Summary','modules/bms/report/clients_notesummary.php','PDF Report',2,'2005-04-03 13:07:00',2,20050405105038,2,10,0); 
     1INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (200,'Invoice','PDF Report',3,100,0,'modules/bms/report/invoices_pdfinvoice.php','This report will gerneate and display an invoice in PDF format (which can be printed or saved).  The PDF file will contain one page per invoice.',1,NOW(),1,NOW()); 
     2INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (201,'Work Order','PDF Report',3,100,20,'modules/bms/report/invoices_pdfworkorder.php','This report will gerneate and display a work order  in PDF format (which can be printed or saved).  The PDF file will contain one page per work order.',1,NOW(),1,NOW()); 
     3INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (202,'Packing List','PDF Report',3,100,0,'modules/bms/report/invoices_pdfpackinglist.php','This report will gerneate and display an invoice packing list in PDF format (which can be printed or saved).  The PDF file will contain one page per invoice packing list.',1,NOW(),1,NOW()); 
     4INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (203,'Labels - Folder','PDF Report',2,50,0,'modules/bms/report/clients_folderlabels.php','Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',1,NOW(),1,NOW()); 
     5INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (204,'Labels - Mailing','PDF Report',2,50,0,'modules/bms/report/clients_mailinglabels.php','Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',1,NOW(),1,NOW()); 
     6INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (205,'Labels - Shipping','PDF Report',2,50,0,'modules/bms/report/clients_shippinglabels.php','Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',1,NOW(),1,NOW()); 
     7INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (206,'Labels - Shipping','PDF Report',3,60,0,'modules/bms/report/invoices_shippinglabels.php','Avery 5160 or compatible (3x10) Instructor Folder labels. \r\n\r\n **MAKE SURE when printing the pdf file, to TURN OFF the option \"shrink oversized pages to paper size\".**',1,NOW(),1,NOW()); 
     8INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (207,'Totals - Custom','report',3,50,30,'modules/bms/report/invoices_totals.php','Creater your own custom invoice totaling report, specify groupings, totals, averages and whether to display summary, invoice, and invoice detail information.',1,NOW(),1,NOW()); 
     9INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (208,'Totals - Amt. w/  Invoices','report',3,50,30,'modules/bms/report/invoices_totals_amtwinv.php','Basic totals report. Shows invoice total, subtotal and amount due fields  and displaying indidivdual invoice information.',1,NOW(),1,NOW()); 
     10INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (209,'Totals - Amt. w/ Invoices + Line Items','report',3,50,30,'modules/bms/report/invoices_totals_amtwinvlineitems.php','Basic totals report. Shows invoice total, subtotal and amount due fields  and displaying indidivdual invoice and line item information.',1,NOW(),1,NOW()); 
     11INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (210,'Totals - Grouped by Acct. Manager','report',3,50,30,'modules/bms/report/invoices_totals_acctmngers.php','Totals report grouping by client account manager',1,NOW(),1,NOW()); 
     12INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (211,'Totals - Grouped by Shipping Method','report',3,50,30,'modules/bms/report/invoices_totals_shippingmethod.php','Totals report including shipping ammount grouped by shipping method',1,NOW(),1,NOW()); 
     13INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (212,'Totals - Grouped by Payment Method','report',3,50,30,'modules/bms/report/invoices_totals_payment.php','Totals report grouped by payment method.',1,NOW(),1,NOW()); 
     14INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (213,'Totals - Grouped by Invoice Lead Source','report',3,50,30,'modules/bms/report/invoices_totals_leadsource.php','Totals - Grouped by invoice lead source',1,NOW(),1,NOW()); 
     15INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (214,'Quote','PDF Report',3,100,20,'modules/bms/report/invoices_pdfquote.php','PDF report for quote.  Does not include amount due.',1,NOW(),1,NOW()); 
     16INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (215,'Sales History','report',4,100,30,'modules/bms/report/products_saleshistory.php','Sales History for product including costs, average price and quantities.',1,NOW(),1,NOW()); 
     17INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (216,'Purchase History','report',2,10,0,'modules/bms/report/clients_purchasehistory.php','Client purchase history',1,NOW(),1,NOW()); 
     18INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (217,'Totals - Custom','report',5,50,30,'modules/bms/report/lineitems_totals.php','Creater your own custom line item  totaling report, specify groupings, totals, averages and whether to display summary, invoice, and invoice detail information.',1,NOW(),1,NOW()); 
     19INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (218,'Totals - Product Categories','report',5,50,30,'modules/bms/report/lineitems_totals_productcategories.php','Totals report grouped first by product category and then by product.',1,NOW(),1,NOW()); 
     20INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (219,'Totals - Product','report',5,50,30,'modules/bms/report/lineitems_totals_products.php','Totals report grouped by product displaying line items',1,NOW(),1,NOW()); 
     21INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (220,'Totals - Lead Source','report',5,50,30,'modules/bms/report/lineitems_totals_leadsource.php','Totals grouped by invoice lead source and product',1,NOW(),1,NOW()); 
     22INSERT INTO `reports` (`id`, `name`, `type`, `tabledefid`, `displayorder`, `roleid`, `reportfile`, `description`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (221,'Client Notes Summary','PDF Report',2,10,0,'modules/bms/report/clients_notesummary.php','Print all notes associated with the client and any notes associated with client invoices.',1,NOW(),1,NOW()); 
  • trunk/phpbms/modules/bms/install/tablecolumns.sql

    r146 r170  
    1 INSERT INTO tablecolumns VALUES (1,2,'id','clients.id','center','',0,'',0,'',NULL); 
    2 INSERT INTO tablecolumns VALUES (2,2,'type','if(clients.type=\"prospect\",\"<span style=\'color:red;\'>P</span>\",\"<b>C</b>\")','center','',1,'',0,'','noencoding'); 
    3 INSERT INTO tablecolumns VALUES (12,2,'name / company','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',2,'',0,'100%',NULL); 
    4 INSERT INTO tablecolumns VALUES (16,2,'city','clients.city','left','',4,'',0,'',NULL); 
    5 INSERT INTO tablecolumns VALUES (17,2,'state','clients.state','left','',5,'',0,'',NULL); 
    6 INSERT INTO tablecolumns VALUES (18,2,'zip','clients.postalcode','left','',6,'',0,'',NULL); 
    7 INSERT INTO tablecolumns VALUES (44,3,'id','invoices.id','left','',0,'',0,'',NULL); 
    8 INSERT INTO tablecolumns VALUES (45,3,'type','invoices.type','left','',1,'',0,'',NULL); 
    9 INSERT INTO tablecolumns VALUES (134,3,'status','invoices.status','left','',2,'',0,'',NULL); 
    10 INSERT INTO tablecolumns VALUES (46,3,'date','if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)','left','',4,'',0,'','date'); 
    11 INSERT INTO tablecolumns VALUES (47,3,'client name / company','concat(\"<strong>\",if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company),\"</strong>\")','left','',5,'concat(clients.lastname,clients.firstname,clients.company)',0,'100%','noencoding'); 
    12 INSERT INTO tablecolumns VALUES (139,5,'id','lineitems.id','left','',0,'',0,'',NULL); 
    13 INSERT INTO tablecolumns VALUES (48,3,'total','if(invoices.type!=\"VOID\",invoices.totalti,\"-----\")','right','sum(if(invoices.type!=\"VOID\",invoices.totalti,0))',6,'if(invoices.type!=\"VOID\",invoices.totalti,0)',0,'','currency'); 
    14 INSERT INTO tablecolumns VALUES (49,3,'due','if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,\"-----\")','right','sum(if(invoices.type!=\"VOID\",(invoices.totalti-invoices.amountpaid),0))',7,'if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,0)',0,'','currency'); 
    15 INSERT INTO tablecolumns VALUES (51,5,'invoice id','lineitems.invoiceid','left','',1,'',0,'',NULL); 
    16 INSERT INTO tablecolumns VALUES (52,5,'part #','products.partnumber','left','',4,'',0,'',NULL); 
    17 INSERT INTO tablecolumns VALUES (53,5,'name','products.partname','left','',5,'',1,'100%',NULL); 
    18 INSERT INTO tablecolumns VALUES (54,5,'unit price','concat(\"$\",format(lineitems.unitprice,2))','right','concat(\"$\",format(sum(lineitems.unitprice),2))',6,'lineitems.unitprice',0,'',NULL); 
    19 INSERT INTO tablecolumns VALUES (55,5,'qty','format(lineitems.quantity,2)','center','format(sum(lineitems.quantity),2)',7,'lineitemd.quantity',0,'',NULL); 
    20 INSERT INTO tablecolumns VALUES (56,5,'price ext.','lineitems.unitprice*lineitems.quantity','right','sum(lineitems.unitprice*lineitems.quantity)',8,'',0,'','currency'); 
    21 INSERT INTO tablecolumns VALUES (57,5,'cost ext.','lineitems.unitcost*lineitems.quantity','right','sum(lineitems.unitcost*lineitems.quantity)',9,'',0,'','currency'); 
    22 INSERT INTO tablecolumns VALUES (58,5,'total wt.','format((lineitems.unitweight*lineitems.quantity),2)','right','format(sum(lineitems.unitweight*lineitems.quantity),2)',11,'lineitems.unitweight*lineitems.quantity',0,'',NULL); 
    23 INSERT INTO tablecolumns VALUES (59,6,'id','tax.id','center','',0,'',0,'',NULL); 
    24 INSERT INTO tablecolumns VALUES (60,6,'name','concat(\"<strong>\",tax.name,\"</strong>\")','left','',1,'tax.name',0,'','noencoding'); 
    25 INSERT INTO tablecolumns VALUES (61,6,'percentage','concat(tax.percentage,\"%\")','left','',2,'tax.percentage',0,'98%',NULL); 
    26 INSERT INTO tablecolumns VALUES (62,4,'id','products.id','center','',0,'',0,'',NULL); 
    27 INSERT INTO tablecolumns VALUES (63,4,'part number','products.partnumber','left','',1,'',0,'',NULL); 
    28 INSERT INTO tablecolumns VALUES (64,4,'name','products.partname','left','',2,'',1,'100%',NULL); 
    29 INSERT INTO tablecolumns VALUES (65,4,'category','productcategories.name','right','',3,'',0,'',NULL); 
    30 INSERT INTO tablecolumns VALUES (66,4,'status','products.status','center','',5,'',0,'',NULL); 
    31 INSERT INTO tablecolumns VALUES (67,4,'unit price','products.unitprice','right','',6,'',0,'','currency'); 
    32 INSERT INTO tablecolumns VALUES (68,7,'id','productcategories.id','center','',0,'',0,'',NULL); 
    33 INSERT INTO tablecolumns VALUES (69,7,'name','productcategories.name','left','',1,'',0,'100%',NULL); 
    34 INSERT INTO tablecolumns VALUES (70,7,'date created','productcategories.creationdate','left','',2,'productcategories.creationdate',0,'','datetime'); 
    35 INSERT INTO tablecolumns VALUES (71,8,'id','prerequisites.id','center','',0,'',0,'',NULL); 
    36 INSERT INTO tablecolumns VALUES (72,8,'part number','products.partnumber','left','',1,'',0,'',NULL); 
    37 INSERT INTO tablecolumns VALUES (73,8,'name','products.partname','left','',2,'',1,'50%',NULL); 
    38 INSERT INTO tablecolumns VALUES (74,8,'dependent part num.','childproducts.partnumber','left','',3,'',0,'50%',NULL); 
    39 INSERT INTO tablecolumns VALUES (75,18,'id','clients.id','center','',0,'',0,'',NULL); 
    40 INSERT INTO tablecolumns VALUES (76,18,'type','if(clients.type=\"prospect\",\"<span style=\'color:red;\'>P</span>\",\"<b>C</b>\")','left','',1,'clients.type',0,'','noencoding'); 
    41 INSERT INTO tablecolumns VALUES (77,18,'company / name','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',2,'',1,'100%',NULL); 
    42 INSERT INTO tablecolumns VALUES (79,18,'city','clients.city','left','',3,'',0,'',NULL); 
    43 INSERT INTO tablecolumns VALUES (80,18,'state','clients.state','center','',4,'',0,'',NULL); 
    44 INSERT INTO tablecolumns VALUES (81,18,'postal code','clients.postalcode','left','',5,'',0,'',NULL); 
    45 INSERT INTO tablecolumns VALUES (102,2,'e-mail','clients.email','left','',3,'',0,'',NULL); 
    46 INSERT INTO tablecolumns VALUES (103,22,'name','clientemailprojects.name','left','',2,'',0,'100%',NULL); 
    47 INSERT INTO tablecolumns VALUES (104,22,'user','if(clientemailprojects.userid=0,\"<b>global</b>\",concat(users.lastname,\", \",users.firstname))','left','',1,'',0,'','noencoding'); 
    48 INSERT INTO tablecolumns VALUES (105,22,'last run','clientemailprojects.lastrun','right','',3,'',0,'','datetime'); 
    49 INSERT INTO tablecolumns VALUES (106,22,'id','clientemailprojects.id','left','',0,'',0,'',NULL); 
    50 INSERT INTO tablecolumns VALUES (136,25,'id','discounts.id','left','',0,'',0,'',NULL); 
    51 INSERT INTO tablecolumns VALUES (135,3,'web','invoices.weborder','center','',3,'',0,'','boolean'); 
    52 INSERT INTO tablecolumns VALUES (108,5,'type','invoices.type','left','',2,'',0,'',NULL); 
    53 INSERT INTO tablecolumns VALUES (109,5,'date','if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)\r\n','left','',3,'',1,'','date'); 
    54 INSERT INTO tablecolumns VALUES (132,4,'type','products.type','center','',4,'',0,'',NULL); 
    55 INSERT INTO tablecolumns VALUES (133,5,'tax','lineitems.taxable','center','',10,'',0,'','boolean'); 
    56 INSERT INTO tablecolumns VALUES (137,25,'type','discounts.type','left','',1,'',0,'',NULL); 
    57 INSERT INTO tablecolumns VALUES (138,25,'name','discounts.name','left','',2,'',0,'100%',NULL); 
     1INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (1,2,'id','clients.id','center','',0,'',0,'',NULL); 
     2INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (2,2,'type','if(clients.type=\"prospect\",\"<span style=\'color:red;\'>P</span>\",\"<b>C</b>\")','center','',1,NULL,0,'','noencoding'); 
     3INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (12,2,'name / company','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',2,'',0,'100%',NULL); 
     4INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (16,2,'city','clients.city','left','',4,'',0,'',NULL); 
     5INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (17,2,'state','clients.state','left','',5,'',0,'',NULL); 
     6INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (18,2,'zip','clients.postalcode','left','',6,'',0,'',NULL); 
     7INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (44,3,'id','invoices.id','left','',0,'',0,'',NULL); 
     8INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (45,3,'type','invoices.type','left','',1,'',0,'',NULL); 
     9INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (134,3,'status','invoices.status','left','',2,'',0,'',NULL); 
     10INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (46,3,'date','if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)','left','',4,'',0,'','date'); 
     11INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (47,3,'client name / company','concat(\"<strong>\",if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company),\"</strong>\")','left','',5,NULL,0,'100%','noencoding'); 
     12INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (139,5,'id','lineitems.id','left','',0,'',0,'',NULL); 
     13INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (48,3,'total','if(invoices.type!=\"VOID\",invoices.totalti,\"-----\")','right','sum(if(invoices.type!=\"VOID\",invoices.totalti,0))',6,'if(invoices.type!=\"VOID\",invoices.totalti,0)',0,'','currency'); 
     14INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (49,3,'due','if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,\"-----\")','right','sum(if(invoices.type!=\"VOID\",(invoices.totalti-invoices.amountpaid),0))',7,'if(invoices.type!=\"VOID\",invoices.totalti-invoices.amountpaid,0)',0,'','currency'); 
     15INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (51,5,'invoice id','lineitems.invoiceid','left','',1,'',0,'',NULL); 
     16INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (52,5,'part #','products.partnumber','left','',4,'',0,'',NULL); 
     17INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (53,5,'name','products.partname','left','',5,'',1,'100%',NULL); 
     18INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (54,5,'unit price','concat(\"$\",format(lineitems.unitprice,2))','right','concat(\"$\",format(sum(lineitems.unitprice),2))',6,'lineitems.unitprice',0,'',NULL); 
     19INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (55,5,'qty','format(lineitems.quantity,2)','center','format(sum(lineitems.quantity),2)',7,'lineitemd.quantity',0,'',NULL); 
     20INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (56,5,'price ext.','lineitems.unitprice*lineitems.quantity','right','sum(lineitems.unitprice*lineitems.quantity)',8,'',0,'','currency'); 
     21INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (57,5,'cost ext.','lineitems.unitcost*lineitems.quantity','right','sum(lineitems.unitcost*lineitems.quantity)',9,'',0,'','currency'); 
     22INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (58,5,'total wt.','format((lineitems.unitweight*lineitems.quantity),2)','right','format(sum(lineitems.unitweight*lineitems.quantity),2)',11,'lineitems.unitweight*lineitems.quantity',0,'',NULL); 
     23INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (59,6,'id','tax.id','center','',0,'',0,'',NULL); 
     24INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (60,6,'name','concat(\"<strong>\",tax.name,\"</strong>\")','left','',1,NULL,0,'','noencoding'); 
     25INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (61,6,'percentage','concat(tax.percentage,\"%\")','left','',2,'tax.percentage',0,'98%',NULL); 
     26INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (62,4,'id','products.id','center','',0,'',0,'',NULL); 
     27INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (63,4,'part number','products.partnumber','left','',1,'',0,'',NULL); 
     28INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (64,4,'name','products.partname','left','',2,'',1,'100%',NULL); 
     29INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (65,4,'category','productcategories.name','right','',3,'',0,'',NULL); 
     30INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (66,4,'status','products.status','center','',5,'',0,'',NULL); 
     31INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (67,4,'unit price','products.unitprice','right','',6,'',0,'','currency'); 
     32INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (68,7,'id','productcategories.id','center','',0,'',0,'',NULL); 
     33INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (69,7,'name','productcategories.name','left','',1,'',0,'100%',NULL); 
     34INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (70,7,'date created','productcategories.creationdate','left','',2,'productcategories.creationdate',0,'','datetime'); 
     35INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (71,8,'id','prerequisites.id','center','',0,'',0,'',NULL); 
     36INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (72,8,'part number','products.partnumber','left','',1,'',0,'',NULL); 
     37INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (73,8,'name','products.partname','left','',2,'',1,'50%',NULL); 
     38INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (74,8,'dependent part num.','childproducts.partnumber','left','',3,'',0,'50%',NULL); 
     39INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (75,18,'id','clients.id','center','',0,'',0,'',NULL); 
     40INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (76,18,'type','if(clients.type=\"prospect\",\"<span style=\'color:red;\'>P</span>\",\"<b>C</b>\")','left','',1,NULL,0,'','noencoding'); 
     41INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (77,18,'company / name','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',2,'',1,'100%',NULL); 
     42INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (79,18,'city','clients.city','left','',3,'',0,'',NULL); 
     43INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (80,18,'state','clients.state','center','',4,'',0,'',NULL); 
     44INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (81,18,'postal code','clients.postalcode','left','',5,'',0,'',NULL); 
     45INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (102,2,'e-mail','clients.email','left','',3,'',0,'',NULL); 
     46INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (103,22,'name','clientemailprojects.name','left','',2,'',0,'100%',NULL); 
     47INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (104,22,'user','if(clientemailprojects.userid=0,\"<b>global</b>\",concat(users.lastname,\", \",users.firstname))','left','',1,NULL,0,'','noencoding'); 
     48INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (105,22,'last run','clientemailprojects.lastrun','right','',3,'',0,'','datetime'); 
     49INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (106,22,'id','clientemailprojects.id','left','',0,'',0,'',NULL); 
     50INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (136,25,'id','discounts.id','left','',0,'',0,'',NULL); 
     51INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (135,3,'web','invoices.weborder','center','',3,'',0,'','boolean'); 
     52INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (108,5,'type','invoices.type','left','',2,'',0,'',NULL); 
     53INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (109,5,'date','if(invoices.type=\"Invoice\",invoices.invoicedate,invoices.orderdate)\r\n','left','',3,'',1,'','date'); 
     54INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (132,4,'type','products.type','center','',4,'',0,'',NULL); 
     55INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (133,5,'tax','lineitems.taxable','center','',10,'',0,'','boolean'); 
     56INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (137,25,'type','discounts.type','left','',1,'',0,'',NULL); 
     57INSERT INTO `tablecolumns` (`id`, `tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`) VALUES (138,25,'name','discounts.name','left','',2,'',0,'100%',NULL); 
  • trunk/phpbms/modules/bms/install/tabledefs.sql

    r145 r170  
    1 INSERT INTO tabledefs VALUES ('modules/bms/clientemailprojects_edit.php','Client E-mail Projects',22,'clientemailprojects',2,'2005-03-15 13:17:07',2,20050317140938,'clientemailprojects left join users on clientemailprojects.userid=users.id','NA','delete','clientemailprojects.id !=-1','clientemailprojects.name','search','','','system',2); 
    2 INSERT INTO tabledefs VALUES ('modules/bms/clients_addedit.php','Clients/Prospects',2,'clients',2,'2003-02-06 15:43:06',2,20050318154822,'clients','modules/bms/clients_addedit.php','inactivate','clients.id=-100','concat(clients.lastname,\", \",clients.firstname)','','','','table',2); 
    3 INSERT INTO tabledefs VALUES ('modules/bms/invoices_addedit.php','Quotes/Orders/Invoices',3,'invoices',2,'2003-02-06 15:45:40',2,20051122181349,'(invoices inner join clients on invoices.clientid=clients.id)','modules/bms/invoices_addedit.php','void','invoices.type+0<3','invoices.id','','','','table',2); 
    4 INSERT INTO tabledefs VALUES ('modules/bms/products_addedit.php','Products',4,'products',2,'2003-02-06 15:46:10',2,20051019132051,'(products inner join productcategories on products.categoryid=productcategories.id)','modules/bms/products_addedit.php','inactivate','products.id =-100','products.partnumber','','','','table',2); 
    5 INSERT INTO tabledefs VALUES ('N/A','Line Items',5,'lineitems',2,'2004-03-04 14:47:49',2,20051021173049,'((lineitems left join products on lineitems.productid=products.id) inner join invoices on lineitems.invoiceid=invoices.id)','N/A','NA','lineitems.id =-1','lineitems.invoiceid,lineitems.id','','','','table',2); 
    6 INSERT INTO tabledefs VALUES ('modules/bms/tax_addedit.php','Tax Areas',6,'tax',2,'2004-03-04 14:48:44',2,20040413102940,'tax','modules/bms/tax_addedit.php','delete','tax.id !=0','tax.name','','','','table',2); 
    7 INSERT INTO tabledefs VALUES ('modules/bms/productcategories_addedit.php','Product Categories',7,'productcategories',2,'2004-03-04 14:49:32',2,20040413102940,'productcategories','modules/bms/productcategories_addedit.php','delete','productcategories.id !=0','productcategories.name','','','','table',2); 
    8 INSERT INTO tabledefs VALUES ('N/A','Prerequisites',8,'prerequisites',2,'2004-03-04 14:50:09',2,20040413102940,'(prerequisites left join products on prerequisites.parentid=products.id) left join products as childproducts on prerequisites.childid=childproducts.id','N/A','NA','prerequisites.id =-1','products.id','','','','table',2); 
    9 INSERT INTO tabledefs VALUES ('N/A','Client/Prospect Duplicates',18,'clients',2,'2004-04-07 13:19:42',2,20040413102940,'(clients, clients dupclients)','N/A','NA','clients.id = -100','concat(clients.lastname,\", \",clients.firstname)','','','','view',2); 
    10 INSERT INTO tabledefs VALUES ('modules/bms/discounts_addedit.php','Dicounts/Promotions',25,'discounts',2,'2005-10-20 12:42:29',2,20051020175114,'discounts','modules/bms/discounts_addedit.php','inactivate','discounts.id!=0','discounts.id','search','all records','name','table',2); 
     1INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (22,'Client E-mail Projects','system',2,'clientemailprojects','clientemailprojects left join users on clientemailprojects.userid=users.id','modules/bms/clientemailprojects_edit.php',0,'NA',0,0,-100,-100,'delete','clientemailprojects.id !=-1','clientemailprojects.name','search','','',1,NOW(),1,NOW()); 
     2INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (2,'Clients/Prospects','table',2,'clients','clients','modules/bms/clients_addedit.php',0,'modules/bms/clients_addedit.php',0,0,-100,-100,'inactivate','clients.id=-100','concat(clients.lastname,\", \",clients.firstname)','','','',1,NOW(),1,NOW()); 
     3INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (3,'Quotes/Orders/Invoices','table',2,'invoices','(invoices inner join clients on invoices.clientid=clients.id)','modules/bms/invoices_addedit.php',0,'modules/bms/invoices_addedit.php',0,0,-100,-100,'void','invoices.type+0<3','invoices.id','','','',1,NOW(),1,NOW()); 
     4INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,0,-100,-100,'inactivate','products.id =-100','products.partnumber','','','',1,NOW(),1,NOW()); 
     5INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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,0,-100,-100,'NA','lineitems.id =-1','lineitems.invoiceid,lineitems.id','','','',1,NOW(),1,NOW()); 
     6INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (6,'Tax Areas','table',2,'tax','tax','modules/bms/tax_addedit.php',0,'modules/bms/tax_addedit.php',0,0,-100,-100,'delete','tax.id !=0','tax.name','','','',1,NOW(),1,NOW()); 
     7INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (7,'Product Categories','table',2,'productcategories','productcategories','modules/bms/productcategories_addedit.php',0,'modules/bms/productcategories_addedit.php',0,0,-100,-100,'delete','productcategories.id !=0','productcategories.name','','','',1,NOW(),1,NOW()); 
     8INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (8,'Prerequisites','table',2,'prerequisites','(prerequisites left join products on prerequisites.parentid=products.id) left join products as childproducts on prerequisites.childid=childproducts.id','N/A',0,'N/A',0,0,-100,-100,'NA','prerequisites.id =-1','products.id','','','',1,NOW(),1,NOW()); 
     9INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (18,'Client/Prospect Duplicates','view',2,'clients','(clients, clients dupclients)','N/A',0,'N/A',0,0,-100,-100,'NA','clients.id = -100','concat(clients.lastname,\", \",clients.firstname)','','','',2,'2004-04-07 13:19:42',1,NOW(),1,NOW()); 
     10INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (25,'Dicounts/Promotions','table',2,'discounts','discounts','modules/bms/discounts_addedit.php',0,'modules/bms/discounts_addedit.php',0,0,-100,-100,'inactivate','discounts.id!=0','discounts.id','search','all records','name',2,'2005-10-20 12:42:29',1,NOW(),1,NOW()); 
  • trunk/phpbms/modules/bms/install/tablefindoptions.sql

    r145 r170  
    1 INSERT INTO tablefindoptions VALUES (1,2,'Prospects','clients.type = \"prospect\"   and clients.inactive=0',1,0); 
    2 INSERT INTO tablefindoptions VALUES (7,2,'Today\'s Prospects','clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate))=0 and clients.inactive=0',3,0); 
    3 INSERT INTO tablefindoptions VALUES (8,2,'Yesterday\'s Prospects','clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate)=1 and clients.inactive=0',4,0); 
    4 INSERT INTO tablefindoptions VALUES (9,2,'Last Week\'s Prospects','clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate))<7 and clients.inactive=0',5,0); 
    5 INSERT INTO tablefindoptions VALUES (10,2,'Clients','clients.type = \"client\" and clients.inactive=0',0,0); 
    6 INSERT INTO tablefindoptions VALUES (11,2,'Inactive Clients','clients.type = \"client\" and clients.inactive=1',6,0); 
    7 INSERT INTO tablefindoptions VALUES (12,2,'All Records','clients.id != 0',7,0); 
    8 INSERT INTO tablefindoptions VALUES (102,3,'Invoices - This Quarter','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(CURDATE()) and QUARTER(invoices.invoicedate)=QUARTER(CURDATE())',15,30); 
    9 INSERT INTO tablefindoptions VALUES (103,3,'Invoices - This Year','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(CURDATE())',17,30); 
    10 INSERT INTO tablefindoptions VALUES (104,3,'Invoices - Last Quarter','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(DATE_SUB(CURDATE(),INTERVAL 3 MONTH)) and QUARTER(invoices.invoicedate)=QUARTER(DATE_SUB(CURDATE(),INTERVAL 3 MONTH))',16,30); 
    11 INSERT INTO tablefindoptions VALUES (106,3,'Orders - Committed','invoices.type=\"Order\" and invoices.status=\"Committed\"',3,-10); 
    12 INSERT INTO tablefindoptions VALUES (107,3,'Orders - Open','invoices.type=\"Order\" and invoices.status=\"Open\"',2,-10); 
    13 INSERT INTO tablefindoptions VALUES (49,3,'Invoices - Today','invoices.type=\"Invoice\" and invoices.invoicedate=curdate()',9,20); 
    14 INSERT INTO tablefindoptions VALUES (50,3,'Invoices - Yesterday','invoices.type=\"Invoice\" and invoices.invoicedate=date_sub(curdate(),INTERVAL 1 DAY)',10,20); 
    15 INSERT INTO tablefindoptions VALUES (45,3,'Invoices - This Month','invoices.type=\"Invoice\" and year(invoicedate)=year(curdate()) and month(invoicedate)=month(curdate())',13,30); 
    16 INSERT INTO tablefindoptions VALUES (22,3,'Orders','invoices.type=\"Order\"',1,-10); 
    17 INSERT INTO tablefindoptions VALUES (23,3,'Orders - Packed','invoices.type=\"Order\" and invoices.status=\"Packed\"',4,-10); 
    18 INSERT INTO tablefindoptions VALUES (24,3,'Orders - Shipped','invoices.type=\"Order\" and invoices.status=\"Shipped\"',5,-10); 
    19 INSERT INTO tablefindoptions VALUES (25,3,'Invoices','invoices.type=\"Invoice\"',8,30); 
    20 INSERT INTO tablefindoptions VALUES (26,3,'Quotes','invoices.type=\"Quote\"',7,20); 
    21 INSERT INTO tablefindoptions VALUES (27,3,'Voided Records','invoices.type=\"VOID\"',18,-10); 
    22 INSERT INTO tablefindoptions VALUES (28,3,'All Records','invoices.id != 0',19,30); 
    23 INSERT INTO tablefindoptions VALUES (46,3,'Invoices - Last Month','invoices.type=\"Invoice\" and year(invoicedate)=year(date_sub(curdate(),INTERVAL 1 MONTH)) and month(invoicedate)=month(date_sub(curdate(),INTERVAL 1 MONTH))',14,30); 
    24 INSERT INTO tablefindoptions VALUES (51,3,'Invoices - This Week','invoices.type=\"Invoice\" and year(invoicedate)=year(curdate()) and week(invoicedate)=week(curdate())',11,30); 
    25 INSERT INTO tablefindoptions VALUES (52,3,'Invoices - Last Week','invoices.type=\"Invoice\" and year(invoicedate)=year(date_sub(curdate(),INTERVAL 7 DAY)) and week(invoicedate)=week(date_sub(curdate(),INTERVAL 7 DAY))',12,30); 
    26 INSERT INTO tablefindoptions VALUES (53,3,'Orders - Today','invoices.type=\"Order\" and invoices.orderdate=curdate()',6,-10); 
    27 INSERT INTO tablefindoptions VALUES (31,4,'In Stock Items','products.status=\"In Stock\"',1,0); 
    28 INSERT INTO tablefindoptions VALUES (32,4,'Out of Stock Items','products.status=\"Out of Stock\"',2,0); 
    29 INSERT INTO tablefindoptions VALUES (33,4,'Backordered Items','products.status=\"Backordered\"',3,0); 
    30 INSERT INTO tablefindoptions VALUES (34,4,'Inactive','products.inactive=1',4,-10); 
    31 INSERT INTO tablefindoptions VALUES (35,4,'All Records','products.id != 0',5,0); 
    32 INSERT INTO tablefindoptions VALUES (29,5,'All Records','lineitems.id!=0',0,30); 
    33 INSERT INTO tablefindoptions VALUES (54,5,'Orders','invoices.type=\"Order\"',1,0); 
    34 INSERT INTO tablefindoptions VALUES (55,5,'Quotes','invoices.type=\"Quote\"',8,0); 
    35 INSERT INTO tablefindoptions VALUES (56,5,'Invoices','invoices.type=\"Invoice\"',9,30); 
    36 INSERT INTO tablefindoptions VALUES (57,5,'Orders - Today','invoices.type=\"Order\" and invoices.orderdate=curdate()',2,0); 
    37 INSERT INTO tablefindoptions VALUES (58,5,'Invoices - Yesterday','invoices.type=\"Invoice\" and invoices.invoicedate=date_sub(curdate(),INTERVAL 1 DAY)',11,0); 
    38 INSERT INTO tablefindoptions VALUES (59,5,'Orders - Yesterday','invoices.type=\"Orders\" and invoices.orderdate=date_sub(curdate(),INTERVAL 1 DAY)',3,0); 
    39 INSERT INTO tablefindoptions VALUES (60,5,'Orders - Last Week','invoices.type=\"Order\" and year(invoices.orderdate)=year(date_sub(curdate(),INTERVAL 7 DAY)) and week(invoices.orderdate)=week(date_sub(curdate(),INTERVAL 7 DAY))',5,0); 
    40 INSERT INTO tablefindoptions VALUES (61,5,'Orders - This Week','invoices.type=\"Order\" and year(invoices.orderdate)=year(curdate()) and week(invoices.orderdate)=week(curdate())',4,0); 
    41 INSERT INTO tablefindoptions VALUES (62,5,'Orders - This Month','invoices.type=\"Order\" and year(invoices.orderdate)=year(curdate()) and month(invoices.orderdate)=month(curdate())',6,0); 
    42 INSERT INTO tablefindoptions VALUES (63,5,'Orders - Last Month','invoices.type=\"Order\" and year(invoices.orderdate)=year(date_sub(curdate(),INTERVAL 1 MONTH)) and month(invoices.orderdate)=month(date_sub(curdate(),INTERVAL 1 MONTH))',7,0); 
    43 INSERT INTO tablefindoptions VALUES (64,5,'Invoices - Today','invoices.type=\"Invoice\" and invoices.invoicedate=curdate()',10,0); 
    44 INSERT INTO tablefindoptions VALUES (65,5,'Invoices - This Week','invoices.type=\"Order\" and year(invoices.orderdate)=year(curdate()) and week(invoices.orderdate)=week(curdate())',12,30); 
    45 INSERT INTO tablefindoptions VALUES (66,5,'Invoices - Last Week','invoices.type=\"Invoice\" and year(invoices.invoicedate)=year(date_sub(curdate(),INTERVAL 7 DAY)) and week(invoices.invoicedate)=week(date_sub(curdate(),INTERVAL 7 DAY))',13,30); 
    46 INSERT INTO tablefindoptions VALUES (67,5,'Invoices - This Month','invoices.type=\"Invoice\" and year(invoices.invoicedate)=year(curdate()) and month(invoices.invoicedate)=month(curdate())',14,30); 
    47 INSERT INTO tablefindoptions VALUES (68,5,'Invoices - Last Month','invoices.type=\"Invoice\" and year(invoicedate)=year(date_sub(curdate(),INTERVAL 1 MONTH)) and month(invoicedate)=month(date_sub(curdate(),INTERVAL 1 MONTH))',15,30); 
    48 INSERT INTO tablefindoptions VALUES (30,6,'All Records','tax.id != 0',1,0); 
    49 INSERT INTO tablefindoptions VALUES (36,7,'All Records','productcategories.id != 0',1,0); 
    50 INSERT INTO tablefindoptions VALUES (37,8,'All Records','prerequisites.id != 0',1,0); 
    51 INSERT INTO tablefindoptions VALUES (38,18,'matching names','clients.firstname=dupclients.firstname and clients.lastname=dupclients.lastname and clients.id<>dupclients.ID',1,0); 
    52 INSERT INTO tablefindoptions VALUES (39,18,'Matching Names and Postal Code','clients.firstname=dupclients.firstname and clients.lastname=dupclients.lastname and clients.postalcode=dupclients.postalcode and clients.id<>dupclients.ID',2,0); 
    53 INSERT INTO tablefindoptions VALUES (40,18,'Matching Addresses','clients.address1=dupclients.address1 and clients.id<>dupclients.ID',3,0); 
    54 INSERT INTO tablefindoptions VALUES (41,18,'Matching Home Phone','clients.homephone=dupclients.homephone and clients.id<>dupclients.ID',4,0); 
    55 INSERT INTO tablefindoptions VALUES (47,22,'all records','clientemailprojects.id!=-1',0,0); 
    56 INSERT INTO tablefindoptions VALUES (48,22,'global projects','clientemailprojects.userid=0',1,0); 
    57 INSERT INTO tablefindoptions VALUES (105,25,'all records','discounts.id!=0',0,-10); 
     1INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (1,2,'Prospects','clients.type = \"prospect\"   and clients.inactive=0',1,0); 
     2INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,2,'Today\'s Prospects','clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate))=0 and clients.inactive=0',3,0); 
     3INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (8,2,'Yesterday\'s Prospects','clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate)=1 and clients.inactive=0',4,0); 
     4INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (9,2,'Last Week\'s Prospects','clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate))<7 and clients.inactive=0',5,0); 
     5INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (10,2,'Clients','clients.type = \"client\" and clients.inactive=0',0,0); 
     6INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (11,2,'Inactive Clients','clients.type = \"client\" and clients.inactive=1',6,0); 
     7INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (12,2,'All Records','clients.id != 0',7,0); 
     8INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (102,3,'Invoices - This Quarter','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(CURDATE()) and QUARTER(invoices.invoicedate)=QUARTER(CURDATE())',15,30); 
     9INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (103,3,'Invoices - This Year','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(CURDATE())',17,30); 
     10INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (104,3,'Invoices - Last Quarter','invoices.type=\"Invoice\" AND YEAR(invoices.invoicedate)=YEAR(DATE_SUB(CURDATE(),INTERVAL 3 MONTH)) and QUARTER(invoices.invoicedate)=QUARTER(DATE_SUB(CURDATE(),INTERVAL 3 MONTH))',16,30); 
     11INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (106,3,'Orders - Committed','invoices.type=\"Order\" and invoices.status=\"Committed\"',3,0); 
     12INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (107,3,'Orders - Open','invoices.type=\"Order\" and invoices.status=\"Open\"',2,0); 
     13INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (49,3,'Invoices - Today','invoices.type=\"Invoice\" and invoices.invoicedate=curdate()',9,20); 
     14INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (50,3,'Invoices - Yesterday','invoices.type=\"Invoice\" and invoices.invoicedate=date_sub(curdate(),INTERVAL 1 DAY)',10,20); 
     15INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (45,3,'Invoices - This Month','invoices.type=\"Invoice\" and year(invoicedate)=year(curdate()) and month(invoicedate)=month(curdate())',13,30); 
     16INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (22,3,'Orders','invoices.type=\"Order\"',1,0); 
     17INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (23,3,'Orders - Packed','invoices.type=\"Order\" and invoices.status=\"Packed\"',4,0); 
     18INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (24,3,'Orders - Shipped','invoices.type=\"Order\" and invoices.status=\"Shipped\"',5,0); 
     19INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (25,3,'Invoices','invoices.type=\"Invoice\"',8,30); 
     20INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (26,3,'Quotes','invoices.type=\"Quote\"',7,20); 
     21INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (27,3,'Voided Records','invoices.type=\"VOID\"',18,0); 
     22INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (28,3,'All Records','invoices.id != 0',19,30); 
     23INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (46,3,'Invoices - Last Month','invoices.type=\"Invoice\" and year(invoicedate)=year(date_sub(curdate(),INTERVAL 1 MONTH)) and month(invoicedate)=month(date_sub(curdate(),INTERVAL 1 MONTH))',14,30); 
     24INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (51,3,'Invoices - This Week','invoices.type=\"Invoice\" and year(invoicedate)=year(curdate()) and week(invoicedate)=week(curdate())',11,30); 
     25INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (52,3,'Invoices - Last Week','invoices.type=\"Invoice\" and year(invoicedate)=year(date_sub(curdate(),INTERVAL 7 DAY)) and week(invoicedate)=week(date_sub(curdate(),INTERVAL 7 DAY))',12,30); 
     26INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (53,3,'Orders - Today','invoices.type=\"Order\" and invoices.orderdate=curdate()',6,0); 
     27INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (31,4,'In Stock Items','products.status=\"In Stock\"',1,0); 
     28INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (32,4,'Out of Stock Items','products.status=\"Out of Stock\"',2,0); 
     29INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (33,4,'Backordered Items','products.status=\"Backordered\"',3,0); 
     30INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (34,4,'Inactive','products.inactive=1',4,0); 
     31INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (35,4,'All Records','products.id != 0',5,0); 
     32INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (29,5,'All Records','lineitems.id!=0',0,30); 
     33INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (54,5,'Orders','invoices.type=\"Order\"',1,0); 
     34INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (55,5,'Quotes','invoices.type=\"Quote\"',8,0); 
     35INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (56,5,'Invoices','invoices.type=\"Invoice\"',9,30); 
     36INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (57,5,'Orders - Today','invoices.type=\"Order\" and invoices.orderdate=curdate()',2,0); 
     37INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (58,5,'Invoices - Yesterday','invoices.type=\"Invoice\" and invoices.invoicedate=date_sub(curdate(),INTERVAL 1 DAY)',11,0); 
     38INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (59,5,'Orders - Yesterday','invoices.type=\"Orders\" and invoices.orderdate=date_sub(curdate(),INTERVAL 1 DAY)',3,0); 
     39INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (60,5,'Orders - Last Week','invoices.type=\"Order\" and year(invoices.orderdate)=year(date_sub(curdate(),INTERVAL 7 DAY)) and week(invoices.orderdate)=week(date_sub(curdate(),INTERVAL 7 DAY))',5,0); 
     40INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (61,5,'Orders - This Week','invoices.type=\"Order\" and year(invoices.orderdate)=year(curdate()) and week(invoices.orderdate)=week(curdate())',4,0); 
     41INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (62,5,'Orders - This Month','invoices.type=\"Order\" and year(invoices.orderdate)=year(curdate()) and month(invoices.orderdate)=month(curdate())',6,0); 
     42INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (63,5,'Orders - Last Month','invoices.type=\"Order\" and year(invoices.orderdate)=year(date_sub(curdate(),INTERVAL 1 MONTH)) and month(invoices.orderdate)=month(date_sub(curdate(),INTERVAL 1 MONTH))',7,0); 
     43INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (64,5,'Invoices - Today','invoices.type=\"Invoice\" and invoices.invoicedate=curdate()',10,0); 
     44INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (65,5,'Invoices - This Week','invoices.type=\"Order\" and year(invoices.orderdate)=year(curdate()) and week(invoices.orderdate)=week(curdate())',12,30); 
     45INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (66,5,'Invoices - Last Week','invoices.type=\"Invoice\" and year(invoices.invoicedate)=year(date_sub(curdate(),INTERVAL 7 DAY)) and week(invoices.invoicedate)=week(date_sub(curdate(),INTERVAL 7 DAY))',13,30); 
     46INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (67,5,'Invoices - This Month','invoices.type=\"Invoice\" and year(invoices.invoicedate)=year(curdate()) and month(invoices.invoicedate)=month(curdate())',14,30); 
     47INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (68,5,'Invoices - Last Month','invoices.type=\"Invoice\" and year(invoicedate)=year(date_sub(curdate(),INTERVAL 1 MONTH)) and month(invoicedate)=month(date_sub(curdate(),INTERVAL 1 MONTH))',15,30); 
     48INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (30,6,'All Records','tax.id != 0',1,0); 
     49INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (36,7,'All Records','productcategories.id != 0',1,0); 
     50INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (37,8,'All Records','prerequisites.id != 0',1,0); 
     51INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (38,18,'matching names','clients.firstname=dupclients.firstname and clients.lastname=dupclients.lastname and clients.id<>dupclients.ID',1,0); 
     52INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (39,18,'Matching Names and Postal Code','clients.firstname=dupclients.firstname and clients.lastname=dupclients.lastname and clients.postalcode=dupclients.postalcode and clients.id<>dupclients.ID',2,0); 
     53INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (40,18,'Matching Addresses','clients.address1=dupclients.address1 and clients.id<>dupclients.ID',3,0); 
     54INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (41,18,'Matching Home Phone','clients.homephone=dupclients.homephone and clients.id<>dupclients.ID',4,0); 
     55INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (47,22,'all records','clientemailprojects.id!=-1',0,0); 
     56INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (48,22,'global projects','clientemailprojects.userid=0',1,0); 
     57INSERT INTO `tablefindoptions` (`id`, `tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (105,25,'all records','discounts.id!=0',0,0); 
  • trunk/phpbms/modules/bms/install/tableoptions.sql

    r145 r170  
    1 INSERT INTO tableoptions VALUES (1,2,'new','1',0,0); 
    2 INSERT INTO tableoptions VALUES (2,2,'edit','1',0,0); 
    3 INSERT INTO tableoptions VALUES (3,2,'printex','1',0,0); 
    4 INSERT INTO tableoptions VALUES (4,2,'select','1',0,0); 
    5 INSERT INTO tableoptions VALUES (63,2,'massEmail','send mass e-mail',1,0); 
    6 INSERT INTO tableoptions VALUES (5,2,'mark_asclient','convert to client',1,0); 
    7 INSERT INTO tableoptions VALUES (6,2,'stamp_infosent','info packet sent',1,0); 
    8 INSERT INTO tableoptions VALUES (7,2,'delete_prospects','delete prospects',1,0); 
    9 INSERT INTO tableoptions VALUES (28,3,'new','1',0,20); 
    10 INSERT INTO tableoptions VALUES (29,3,'select','1',0,0); 
    11 INSERT INTO tableoptions VALUES (30,3,'edit','1',0,0); 
    12 INSERT INTO tableoptions VALUES (31,3,'printex','1',0,0); 
    13 INSERT INTO tableoptions VALUES (79,3,'mark_asuninvoice','remove invoice status',1,90); 
    14 INSERT INTO tableoptions VALUES (32,3,'mark_aspaid','mark paid in full',1,0); 
    15 INSERT INTO tableoptions VALUES (33,3,'mark_asinvoice','convert to invoice',1,30); 
    16 INSERT INTO tableoptions VALUES (34,3,'mark_ashipped','mark as shipped',1,0); 
    17 INSERT INTO tableoptions VALUES (41,4,'new','1',0,0); 
    18 INSERT INTO tableoptions VALUES (42,4,'edit','1',0,0); 
    19 INSERT INTO tableoptions VALUES (43,4,'select','1',0,0); 
    20 INSERT INTO tableoptions VALUES (44,4,'printex','1',0,0); 
    21 INSERT INTO tableoptions VALUES (35,5,'new','0',0,0); 
    22 INSERT INTO tableoptions VALUES (36,5,'select','1',0,0); 
    23 INSERT INTO tableoptions VALUES (37,5,'edit','0',0,0); 
    24 INSERT INTO tableoptions VALUES (68,5,'printex','1',0,0); 
    25 INSERT INTO tableoptions VALUES (38,6,'new','1',0,0); 
    26 INSERT INTO tableoptions VALUES (39,6,'select','1',0,0); 
    27 INSERT INTO tableoptions VALUES (40,6,'edit','1',0,0); 
    28 INSERT INTO tableoptions VALUES (45,7,'new','1',0,0); 
    29 INSERT INTO tableoptions VALUES (46,7,'edit','1',0,0); 
    30 INSERT INTO tableoptions VALUES (47,7,'select','1',0,0); 
    31 INSERT INTO tableoptions VALUES (48,7,'printex','1',0,0); 
    32 INSERT INTO tableoptions VALUES (49,8,'new','0',0,0); 
    33 INSERT INTO tableoptions VALUES (50,8,'select','1',0,0); 
    34 INSERT INTO tableoptions VALUES (51,8,'edit','0',0,0); 
    35 INSERT INTO tableoptions VALUES (52,18,'new','0',0,0); 
    36 INSERT INTO tableoptions VALUES (53,18,'edit','0',0,0); 
    37 INSERT INTO tableoptions VALUES (54,18,'select','1',0,0); 
    38 INSERT INTO tableoptions VALUES (55,18,'delete_prospects','delete prospects',0,0); 
    39 INSERT INTO tableoptions VALUES (64,22,'new','0',0,0); 
    40 INSERT INTO tableoptions VALUES (65,22,'edit','1',0,0); 
    41 INSERT INTO tableoptions VALUES (66,22,'select','1',0,0); 
    42 INSERT INTO tableoptions VALUES (67,22,'printex','0',0,0); 
    43 INSERT INTO tableoptions VALUES (80,25,'new','1',0,-10); 
    44 INSERT INTO tableoptions VALUES (81,25,'select','1',0,-10); 
    45 INSERT INTO tableoptions VALUES (82,25,'edit','1',0,-10); 
     1INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (1,2,'new','1',0,0); 
     2INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (2,2,'edit','1',0,0); 
     3INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (3,2,'printex','1',0,0); 
     4INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (4,2,'select','1',0,0); 
     5INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (63,2,'massEmail','send mass e-mail',1,0); 
     6INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (5,2,'mark_asclient','convert to client',1,0); 
     7INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (6,2,'stamp_infosent','info packet sent',1,0); 
     8INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (7,2,'delete_prospects','delete prospects',1,0); 
     9INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (28,3,'new','1',0,20); 
     10INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (29,3,'select','1',0,0); 
     11INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (30,3,'edit','1',0,0); 
     12INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (31,3,'printex','1',0,0); 
     13INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (79,3,'mark_asuninvoice','remove invoice status',1,-100); 
     14INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (32,3,'mark_aspaid','mark paid in full',1,0); 
     15INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (33,3,'mark_asinvoice','convert to invoice',1,30); 
     16INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (34,3,'mark_ashipped','mark as shipped',1,0); 
     17INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (41,4,'new','1',0,0); 
     18INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (42,4,'edit','1',0,0); 
     19INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (43,4,'select','1',0,0); 
     20INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (44,4,'printex','1',0,0); 
     21INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (35,5,'new','0',0,0); 
     22INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (36,5,'select','1',0,0); 
     23INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (37,5,'edit','0',0,0); 
     24INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (68,5,'printex','1',0,0); 
     25INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (38,6,'new','1',0,0); 
     26INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (39,6,'select','1',0,0); 
     27INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (40,6,'edit','1',0,0); 
     28INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (45,7,'new','1',0,0); 
     29INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (46,7,'edit','1',0,0); 
     30INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (47,7,'select','1',0,0); 
     31INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (48,7,'printex','1',0,0); 
     32INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (49,8,'new','0',0,0); 
     33INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (50,8,'select','1',0,0); 
     34INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (51,8,'edit','0',0,0); 
     35INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (52,18,'new','0',0,0); 
     36INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (53,18,'edit','0',0,0); 
     37INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (54,18,'select','1',0,0); 
     38INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (55,18,'delete_prospects','delete prospects',0,0); 
     39INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (64,22,'new','0',0,0); 
     40INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (65,22,'edit','1',0,0); 
     41INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (66,22,'select','1',0,0); 
     42INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (67,22,'printex','0',0,0); 
     43INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (80,25,'new','1',0,0); 
     44INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (81,25,'select','1',0,0); 
     45INSERT INTO `tableoptions` (`id`, `tabledefid`, `name`, `option`, `othercommand`, `roleid`) VALUES (82,25,'edit','1',0,0); 
  • trunk/phpbms/modules/bms/install/tablesearchablefields.sql

    r145 r170  
    1 INSERT INTO tablesearchablefields VALUES (1,2,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',0,'whereclause'); 
    2 INSERT INTO tablesearchablefields VALUES (14,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'); 
    3 INSERT INTO tablesearchablefields VALUES (17,2,'clients.city','city',2,'field'); 
    4 INSERT INTO tablesearchablefields VALUES (18,2,'clients.state','state',3,'field'); 
    5 INSERT INTO tablesearchablefields VALUES (19,2,'clients.postalcode','postal code',4,'field'); 
    6 INSERT INTO tablesearchablefields VALUES (20,2,'clients.email','e-mail',5,'field'); 
    7 INSERT INTO tablesearchablefields VALUES (21,2,'clients.leadsource','lead source',6,'field'); 
    8 INSERT INTO tablesearchablefields VALUES (22,2,'clients.id','id',7,'field'); 
    9 INSERT INTO tablesearchablefields VALUES (72,3,'invoices.orderdate','order date',2,'field'); 
    10 INSERT INTO tablesearchablefields VALUES (73,3,'invoices.invoicedate','invoice date',3,'field'); 
    11 INSERT INTO tablesearchablefields VALUES (40,3,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',1,'whereclause'); 
    12 INSERT INTO tablesearchablefields VALUES (41,3,'invoices.id','id',0,'field'); 
    13 INSERT INTO tablesearchablefields VALUES (48,4,'products.partnumber','part number',0,'field'); 
    14 INSERT INTO tablesearchablefields VALUES (49,4,'products.partname','part name',1,'field'); 
    15 INSERT INTO tablesearchablefields VALUES (50,4,'products.unitprice','unit price',2,'field'); 
    16 INSERT INTO tablesearchablefields VALUES (51,4,'products.id','id',3,'field'); 
    17 INSERT INTO tablesearchablefields VALUES (42,5,'products.partnumber','part number',0,'field'); 
    18 INSERT INTO tablesearchablefields VALUES (43,5,'lineitems.invoiceid','invoice id',2,'field'); 
    19 INSERT INTO tablesearchablefields VALUES (44,5,'lineitems.id','id',8,'field'); 
    20 INSERT INTO tablesearchablefields VALUES (76,5,'invoices.orderdate','order date',3,'field'); 
    21 INSERT INTO tablesearchablefields VALUES (77,5,'invoices.invoicedate','invoice date',4,'field'); 
    22 INSERT INTO tablesearchablefields VALUES (45,5,'products.partname','part name',1,'field'); 
    23 INSERT INTO tablesearchablefields VALUES (46,6,'tax.name','name',0,'field'); 
    24 INSERT INTO tablesearchablefields VALUES (47,6,'tax.id','id',1,'field'); 
    25 INSERT INTO tablesearchablefields VALUES (52,7,'productcategories.name','name',0,'field'); 
    26 INSERT INTO tablesearchablefields VALUES (53,7,'productcategories.id','id',1,'field'); 
    27 INSERT INTO tablesearchablefields VALUES (54,8,'products.partnumber','part number',0,'field'); 
    28 INSERT INTO tablesearchablefields VALUES (55,8,'products.partname','part name',1,'field'); 
    29 INSERT INTO tablesearchablefields VALUES (56,8,'childproducts.partnumber','dependent part number',2,'field'); 
    30 INSERT INTO tablesearchablefields VALUES (57,8,'childproducts.partname','dependent name',3,'field'); 
    31 INSERT INTO tablesearchablefields VALUES (58,8,'prerequisites.id','id',4,'field'); 
    32 INSERT INTO tablesearchablefields VALUES (59,18,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',0,'whereclause'); 
    33 INSERT INTO tablesearchablefields VALUES (61,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 VALUES (62,18,'clients.city','city',2,'field'); 
    35 INSERT INTO tablesearchablefields VALUES (63,18,'clients.state','state',3,'field'); 
    36 INSERT INTO tablesearchablefields VALUES (64,18,'clients.postalcode','postal code',4,'field'); 
    37 INSERT INTO tablesearchablefields VALUES (65,18,'clients.email','e-mail',5,'field'); 
    38 INSERT INTO tablesearchablefields VALUES (66,18,'clients.id','id',6,'field'); 
    39 INSERT INTO tablesearchablefields VALUES (74,22,'clientemailprojects.name','name',0,'field'); 
    40 INSERT INTO tablesearchablefields VALUES (75,22,'users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\"','user',1,'whereclause'); 
    41 INSERT INTO tablesearchablefields VALUES (95,25,'discounts.name','name',0,'field'); 
     1INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (1,2,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',0,'whereclause'); 
     2INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (14,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` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (17,2,'clients.city','city',2,'field'); 
     4INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,2,'clients.state','state',3,'field'); 
     5INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (19,2,'clients.postalcode','postal code',4,'field'); 
     6INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (20,2,'clients.email','e-mail',5,'field'); 
     7INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (21,2,'clients.leadsource','lead source',6,'field'); 
     8INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (22,2,'clients.id','id',7,'field'); 
     9INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (72,3,'invoices.orderdate','order date',2,'field'); 
     10INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (73,3,'invoices.invoicedate','invoice date',3,'field'); 
     11INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (40,3,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',1,'whereclause'); 
     12INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (41,3,'invoices.id','id',0,'field'); 
     13INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (48,4,'products.partnumber','part number',0,'field'); 
     14INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (49,4,'products.partname','part name',1,'field'); 
     15INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (50,4,'products.unitprice','unit price',2,'field'); 
     16INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (51,4,'products.id','id',3,'field'); 
     17INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (42,5,'products.partnumber','part number',0,'field'); 
     18INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (43,5,'lineitems.invoiceid','invoice id',2,'field'); 
     19INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (44,5,'lineitems.id','id',8,'field'); 
     20INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (76,5,'invoices.orderdate','order date',3,'field'); 
     21INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (77,5,'invoices.invoicedate','invoice date',4,'field'); 
     22INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (45,5,'products.partname','part name',1,'field'); 
     23INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (46,6,'tax.name','name',0,'field'); 
     24INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (47,6,'tax.id','id',1,'field'); 
     25INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (52,7,'productcategories.name','name',0,'field'); 
     26INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (53,7,'productcategories.id','id',1,'field'); 
     27INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (54,8,'products.partnumber','part number',0,'field'); 
     28INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (55,8,'products.partname','part name',1,'field'); 
     29INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (56,8,'childproducts.partnumber','dependent part number',2,'field'); 
     30INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (57,8,'childproducts.partname','dependent name',3,'field'); 
     31INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (58,8,'prerequisites.id','id',4,'field'); 
     32INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (59,18,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',0,'whereclause'); 
     33INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (61,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'); 
     34INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (62,18,'clients.city','city',2,'field'); 
     35INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (63,18,'clients.state','state',3,'field'); 
     36INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (64,18,'clients.postalcode','postal code',4,'field'); 
     37INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (65,18,'clients.email','e-mail',5,'field'); 
     38INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (66,18,'clients.id','id',6,'field'); 
     39INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (74,22,'clientemailprojects.name','name',0,'field'); 
     40INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (75,22,'users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\"','user',1,'whereclause'); 
     41INSERT INTO `tablesearchablefields` (`id`, `tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (95,25,'discounts.name','name',0,'field'); 
  • trunk/phpbms/modules/bms/install/update.php

    r145 r170  
    114114         
    115115        function verifyAdminLogin($user,$pass,$encryptionSeed,$dblink){ 
    116                 $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=encode(\"".$pass."\",\"".$encryptionSeed."\") AND accesslevel>=90"; 
     116                $querystatement="SELECT id FROM users WHERE login=\"".$user."\" AND password=encode(\"".$pass."\",\"".$encryptionSeed."\") AND admin=1"; 
    117117                $queryresult=mysql_query($querystatement,$dblink); 
    118118                if(!$queryresult) die("what the!");//return false; 
  • trunk/phpbms/modules/bms/invoices_addedit.php

    r161 r170  
    117117                                        $thechoices[]=array("name"=>"Quote","value"=>"Quote"); 
    118118                                        $thechoices[]=array("name"=>"Order","value"=>"Order"); 
    119                                         if($_SESSION["userinfo"]["accesslevel"]>=30) $thechoices[]=array("name"=>"Invoice","value"=>"Invoice"); 
     119                                        if(hasRights(30)) $thechoices[]=array("name"=>"Invoice","value"=>"Invoice"); 
    120120                                        $thechoices[]=array("name"=>"VOID","value"=>"VOID"); 
    121121                                        basic_choicelist("type",$therecord["type"],$thechoices,array("onchange"=>"checkType(this)","class"=>"important","style"=>"width:90px","tabindex"=>"9")); 
     
    321321                <input name="Button" type="button" class="Buttons" onClick="this.form['amountpaid'].value=this.form['totalti'].value;calculatePaidDue();" value="pay in full"  tabindex="24"/> 
    322322        </p>     
    323         <?php if($_SESSION["userinfo"]["accesslevel"]>=20){ ?> 
     323        <?php if(hasRights(20)){ ?> 
    324324        <p> 
    325325                <label for="paymentmethod">payment method</label><br /> 
     
    350350                        <input id="ccverification" name="ccverification" type="text"  value="<?php echo htmlQuotes($therecord["ccverification"]) ?>" size="8" maxlength="7" tabindex="29" />             
    351351                </p>                             
    352         </div><?php }// end if accesslevel?> 
     352        </div><?php }// end if access?> 
    353353</fieldset> 
    354354<div id="fsShipping"> 
  • trunk/phpbms/modules/bms/invoices_attachments.php

    r145 r170  
    4848        $tabledefid=3; 
    4949        $refid=(integer) $_GET["refid"]; 
    50         $whereclause="attachments.tabledefid=".$tabledefid." AND attachments.recordid=".$refid." AND files.accesslevel<=".$_SESSION["userinfo"]["accesslevel"]; 
     50        $securitywhere=""; 
     51        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0)                
     52                $securitywhere=" AND files.roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)";       
     53        $whereclause="attachments.tabledefid=".$tabledefid." AND attachments.recordid=".$refid.$securitywhere; 
    5154        $backurl="../bms/invoices_attachments.php"; 
    5255        $base="../../"; 
  • trunk/phpbms/modules/bms/products_attachments.php

    r145 r170  
    4848        $tabledefid=4; 
    4949        $refid=(integer) $_GET["refid"]; 
    50         $whereclause="attachments.tabledefid=".$tabledefid." AND attachments.recordid=".$refid." AND files.accesslevel<=".$_SESSION["userinfo"]["accesslevel"]; 
     50        $securitywhere=""; 
     51        if ($_SESSION["userinfo"]["admin"]!=1 && count($_SESSION["userinfo"]["roles"])>0)                
     52                $securitywhere=" AND files.roleid IN (".implode(",",$_SESSION["userinfo"]["roles"]).",0)";       
     53        $whereclause="attachments.tabledefid=".$tabledefid." AND attachments.recordid=".$refid.$securitywhere 
    5154        $backurl="../bms/products_attachments.php"; 
    5255        $base="../../"; 
  • trunk/phpbms/modules/bms/products_saleshistory.php

    r166 r170  
    4141        include("../../include/fields.php"); 
    4242         
    43         if($_SESSION["userinfo"]["accesslevel"]<30) goURL($_SESSION["app_path"]."noaccess.html");        
     43        if(!hasRights(30)) goURL($_SESSION["app_path"]."noaccess.php"); 
    4444         
    4545        include("include/products_functions.php"); 
  • trunk/phpbms/modules/bms/report/clients_folderlabels.php

    r145 r170  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
     39        session_cache_limiter('private'); 
     40        require_once("../../../include/session.php"); 
     41        require_once("../../../fpdf/fpdf.php"); 
     42 
    3943        if($_SESSION["printing"]["sortorder"]) 
    4044                $sortorder=$_SESSION["printing"]["sortorder"]; 
     
    7276        } 
    7377 
    74         session_cache_limiter('private'); 
    75         require_once("../../../include/session.php"); 
    76         require_once("../../../fpdf/fpdf.php"); 
    7778        require("../../../report/general_labels.php"); 
    7879?> 
  • trunk/phpbms/modules/bms/report/clients_mailinglabels.php

    r145 r170  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
     39        session_cache_limiter('private'); 
     40        require_once("../../../include/session.php"); 
     41        require_once("../../../fpdf/fpdf.php"); 
    3942 
    4043        if($_SESSION["printing"]["sortorder"]) 
     
    7780        } 
    7881 
    79         session_cache_limiter('private'); 
    80         require_once("../../../include/session.php"); 
    81         require_once("../../../fpdf/fpdf.php"); 
    8282        require("../../../report/general_labels.php"); 
    8383?> 
  • trunk/phpbms/modules/bms/report/clients_purchasehistory.php

    r163 r170  
    109109                                inner join lineitems on invoices.id=lineitems.invoiceid)  
    110110                                        inner join products on lineitems.productid=products.id 
    111                 WHERE clients.id=".$_GET["id"]."    
     111                WHERE clients.id=".$id."    
    112112                and ".$thestatus."               
    113113                HAVING  
  • trunk/phpbms/modules/bms/report/clients_shippinglabels.php

    r145 r170  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
     39        session_cache_limiter('private'); 
     40        require_once("../../../include/session.php"); 
     41        require_once("../../../fpdf/fpdf.php"); 
    3942 
    4043        if($_SESSION["printing"]["sortorder"]) 
     
    7780                return $pdf; 
    7881        } 
    79  
    80         session_cache_limiter('private'); 
    81         require_once("../../../include/session.php"); 
    82         require_once("../../../fpdf/fpdf.php"); 
    8382        require("../../../report/general_labels.php"); 
    8483?> 
  • trunk/phpbms/modules/bms/snapshot.php

    r162 r170  
    132132} 
    133133 
    134 if ($_SESSION["userinfo"]["accesslevel"]>=20) {?> 
     134if (hasRights(20)) {?> 
    135135<div class="box" id="bmsBox"> 
    136136        <button class="graphicButtons buttonDown" id="todaysOrdersLink"><span>Up</span></button>         
  • trunk/phpbms/print.php

    r167 r170  
    198198                                        <option value="selected">selected records (<?php echo count($tablePrinter->theids) ?> record<?php if(count($tablePrinter->theids)>1) echo "s"?>)</option> 
    199199                                        <option value="savedsearch">saved search...</option> 
    200                                         <?php if($_SESSION["userinfo"]["accesslevel"]>=30){?><option value="all">all records in table</option><?php }?> 
     200                                        <?php if($_SESSION["userinfo"]["admin"]==1){?><option value="all">all records in table</option><?php }?> 
    201201                                </select> 
    202202                        </p> 
  • trunk/phpbms/servefile.php

    r145 r170  
    4040session_cache_limiter('private'); 
    4141require_once("include/session.php"); 
    42 if(isset($_GET["i"]) && isset($_SESSION["userinfo"]["accesslevel"])) { 
    43         $querystatement="SELECT file,type,name FROM files WHERE id=".((integer)$_GET["i"])." AND accesslevel<=".$_SESSION["userinfo"]["accesslevel"]; 
     42require_once("include/common_functions.php"); 
     43if(isset($_GET["i"])) { 
     44        $querystatement="SELECT file,type,name,roleid FROM files WHERE id=".((integer)$_GET["i"]); 
    4445        @ $queryresult=mysql_query($querystatement,$dblink); 
    4546        if($queryresult) { 
    4647                if(mysql_num_rows($queryresult)){ 
    4748                        $therecord=mysql_fetch_array($queryresult); 
    48                         header("Content-type: ".$therecord["type"]); 
    49                         header("Content-Disposition: attachment; filename=\"".rawurlencode($therecord["name"])."\""); 
    50                  
    51                         echo $therecord["file"]; 
     49                        if(hasRights($therecord["roleid"])){ 
     50                                header("Content-type: ".$therecord["type"]); 
     51                                header("Content-Disposition: attachment; filename=\"".rawurlencode($therecord["name"])."\""); 
     52                         
     53                                echo $therecord["file"]; 
     54                        } 
    5255                } 
    5356        } 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.