navigation  interaction  search

 other resources

Changeset 385

Show
Ignore:
Timestamp:
05/05/08 14:17:04
Author:
brieb
Message:
  • Implemented client, client dup, address, and a2r tabledefs and table support install/update procedures
  • Added code to delete prospect function to handle new multi-address support
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phpbms/modules/bms/include/clients.php

    r384 r385  
    268268                        //passed variable is array of user ids to be revoked 
    269269                        $clientWhereClause = $this->buildWhereClause(); 
    270                                                  
    271                         //next get any quotes that we may have to delete 
    272                         $invoiceWhereClause = $this->buildWhereClause("clientid"); 
    273                         $invoicestatement = " 
     270 
     271                        $querystatement = " 
    274272                                SELECT 
    275                                         invoices.i
     273                                        i
    276274                                FROM 
    277                                         invoices INNER JOIN clients ON invoices.clientid = clients.id 
     275                                        clients 
    278276                                WHERE 
    279                                         (".$invoiceWhereClause.") 
    280                                         AND clients.type='prospect'"; 
    281                                          
    282                         $invoiceresult = $this->db->query($invoicestatement); 
    283                          
    284                         //build invoice id array 
    285                         $invoiceids = array(); 
    286                         while($therecord = $this->db->fetchArray($invoiceresult)) 
    287                                 $invoiceids[] = $therecord["id"]; 
    288                          
    289                         if(count($invoiceids)) { 
    290                                 $invoiceWhereClause = $this->buildWhereClause("invoices.id", $invoiceids); 
    291                                  
    292                                 $lineitemWhereClause = $this->buildWhereClause("invoiceid", $invoiceids); 
    293          
    294                                 $lineItemDeleteStatement = " 
     277                                        (".$clientWhereClause.") 
     278                                        AND clients.type = 'prospect'"; 
     279                                         
     280                        $queryresult = $this->db->query($querystatement); 
     281                         
     282                        //build array of ids to be removed 
     283                        $deleteIDs = array(); 
     284                        while($therecord = $this->db->fetchArray($queryresult)) 
     285                                array_push($deleteIDs, $therecord["id"]); 
     286 
     287                        if(count($deleteIDs)){ 
     288                         
     289                                $a2rWhere = $this->buildWhereClause("recordid", $deleteIDS); 
     290 
     291                                //First we get a list of all the addresses for the prospect 
     292                                $querystatement = " 
     293                                        SELECT DISTINCT 
     294                                                addressid 
     295                                        FROM 
     296                                                addresstorecord 
     297                                        WHERE 
     298                                                tabledefid = 2 
     299                                                AND (".$a2rWhere.")"; 
     300                                                 
     301                                $a2rResult = $this->db->query($querystatement); 
     302                                 
     303                                $addressIDs = array(); 
     304                                while($a2r = $this->db->fetchArray($a2rResult)) 
     305                                        array_push($addressIDs, $a2r["addressid"]); 
     306                                         
     307                                // delete all a2r records for prospect   
     308                                $deletestatement = " 
    295309                                        DELETE FROM 
    296                                                 lineitems 
     310                                                addresstorecord 
    297311                                        WHERE 
    298                                                 ".$lineitemWhereClause; 
    299          
    300                                 $queryresult = $this->db->query($lineItemDeleteStatement); 
    301          
    302                                 $statushistoryDeleteStatement = " 
    303                                         DELETE FROM 
    304                                                 invoicestatushistory 
     312                                                tabledefid = 2 
     313                                                AND (".$a2rWhere.")"; 
     314                                                 
     315                                $this->db->query($deletestatement); 
     316                                 
     317                                //now go get a list of orphaned addresses 
     318                                $querystatement = " 
     319                                        SELECT  
     320                                                addresses.id,  
     321                                                addresstorecord.id as a2rid  
     322                                        FROM  
     323                                                addresses LEFT JOIN addresstorecord ON addresstorecord.addressid = addresses.id 
    305324                                        WHERE 
    306                                                 ".$lineitemWhereClause; 
    307          
    308                                 $queryresult = $this->db->query($statushistoryDeleteStatement); 
    309                                  
    310                                 $invoiceDeleteStatement = " 
    311                                         DELETE FROM 
     325                                                ".$this->buildWhereClause("addresses.id", $addressIDs); 
     326                                                 
     327                                $addressResult = $this->db->query($querystatement); 
     328                                 
     329                                $addressIDs = array(); 
     330                                while($address = $this->db->fetchArray($addressResult)) 
     331                                        if(!$address["a2rid"]) 
     332                                                array_push($addressIDs, $address["id"]); 
     333                                                 
     334                                if(count($addressIDs)){ 
     335                                 
     336                                        //delete orphaned addresses              
     337                                        $deletestatement = " 
     338                                                DELETE FROM  
     339                                                        addresses 
     340                                                WHERE 
     341                                                        ".$this->buildWhereClause("addresses.id", $addressIDs); 
     342                                                         
     343                                        $this->db->query($deletestatement); 
     344                                         
     345                                }//endif - addressids 
     346 
     347                                //next get any quotes that we may have to delete 
     348                                $invoiceWhereClause = $this->buildWhereClause("clientid", $deleteIDs); 
     349                                $invoicestatement = " 
     350                                        SELECT 
     351                                                invoices.id 
     352                                        FROM 
    312353                                                invoices 
    313                                         WHERE                                   
     354                                        WHERE 
    314355                                                ".$invoiceWhereClause; 
    315  
    316                                 $queryresult = $this->db->query($invoiceDeleteStatement); 
    317  
    318                         }//end if 
    319  
    320                         $deletestatement = " 
    321                                 DELETE FROM  
    322                                         clients 
    323                                 WHERE  
    324                                         (".$clientWhereClause.")  
    325                                         AND clients.type='prospect'"; 
    326                                          
    327                         $queryresult = $this->db->query($deletestatement); 
    328                  
    329                         $message = $this->buildStatusMessage(); 
     356                                                 
     357                                $invoiceresult = $this->db->query($invoicestatement); 
     358                                 
     359                                //build invoice id array 
     360                                $invoiceids = array(); 
     361                                while($therecord = $this->db->fetchArray($invoiceresult)) 
     362                                        array_push($invoiceids, $therecord["id"]); 
     363                                 
     364                                if(count($invoiceids)) { 
     365                                        $invoiceWhereClause = $this->buildWhereClause("invoices.id", $invoiceids); 
     366                                         
     367                                        $lineitemWhereClause = $this->buildWhereClause("invoiceid", $invoiceids); 
     368                 
     369                                        $lineItemDeleteStatement = " 
     370                                                DELETE FROM 
     371                                                        lineitems 
     372                                                WHERE 
     373                                                        ".$lineitemWhereClause; 
     374                 
     375                                        $queryresult = $this->db->query($lineItemDeleteStatement); 
     376                 
     377                                        $statushistoryDeleteStatement = " 
     378                                                DELETE FROM 
     379                                                        invoicestatushistory 
     380                                                WHERE 
     381                                                        ".$lineitemWhereClause; 
     382                 
     383                                        $queryresult = $this->db->query($statushistoryDeleteStatement); 
     384                                         
     385                                        $invoiceDeleteStatement = " 
     386                                                DELETE FROM 
     387                                                        invoices 
     388                                                WHERE                                    
     389                                                        ".$invoiceWhereClause; 
     390         
     391                                        $queryresult = $this->db->query($invoiceDeleteStatement); 
     392         
     393                                }//end if 
     394 
     395                                //lastly we remove the prospect record 
     396                                $delWhere = $this->buildWhereClause("clients.id", $deleteIDS); 
     397 
     398                                $deletestatement = " 
     399                                        DELETE FROM  
     400                                                clients 
     401                                        WHERE  
     402                                                ".$delWhere; 
     403                                                 
     404                                $this->db->query($deletestatement); 
     405                                                         
     406                        }//endif - count deleteIDS                                                                                               
     407 
     408                 
     409                        $message = $this->buildStatusMessage(count($deleteIDs)); 
    330410                        $message.=" deleted."; 
    331411                        return $message;         
    332412                         
    333                 }// end method 
     413                }// end method - delete_prospects 
    334414                 
    335415                 
  • trunk/phpbms/modules/bms/install/tablecolumns.sql

    r311 r385  
    1 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (2,'type','clients.type','left','',0,'',0,'',NULL,0); 
    2 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (2,'name / company','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',2,'',0,'100%',NULL,0); 
    3 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (2,'city','clients.city','left','',4,'',0,'',NULL,0); 
    4 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (2,'state','clients.state','left','',5,'',0,'',NULL,10); 
    5 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (2,'zip','clients.postalcode','left','',6,'',0,'',NULL,0); 
    6 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (2,'e-mail','clients.email','left','',3,'',0,'',NULL,0); 
    7 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (2,'has credit','clients.hascredit','center','',1,'',0,'','boolean',80); 
     1INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'e-mail', 'clients.email', 'left', '', '3', '', '0', '', NULL, '0'); 
     2INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'has credit', 'clients.hascredit', 'center', '', '1', '', '0', '', 'boolean', '80'); 
     3INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'name / location', 'CONCAT(\'[b]\',IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\')),\'[/b][br][space]\', IF(addresses.city != \'\' OR addresses.state !=\'\' OR addresses.postalcode != \'\', CONCAT(IF(addresses.city != \'\',addresses.city,\'\'),\', \',IF(addresses.state != \'\', addresses.state, \'\'),\' \',IF(addresses.postalcode != \'\', addresses.postalcode, \'\')),\'(no location)\'))', 'left', '', '2', 'concat(clients.company,clients.lastname,clients.firstname)', '0', '100%', 'bbcode', '0'); 
     4INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'type', 'clients.type', 'left', '', '0', '', '0', '', NULL, '0'); 
     5INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'phone', 'IF(clients.workphone != \'\' OR clients.homephone != \'\' OR clients.mobilephone != \'\' OR clients.otherphone != \'\',IF(clients.workphone != \'\', concat(clients.workphone, \' (w)\'), IF(clients.homephone != \'\', concat(clients.homephone, \' (h)\'), IF(clients.mobilephone != \'\', concat(clients.mobilephone, \' (m)\'), IF(clients.otherphone != \'\', concat(clients.otherphone, \' (o)\'), \'\')))) ,\'\')', 'left', '', '4', 'concat(clients.workphone, clients.homephone, clients.mobilephone,clients.otherphone)', '0', '', NULL, '0'); 
    86INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'id','invoices.id','left','',0,'',0,'',NULL,0); 
    97INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (3,'type','invoices.type','left','',2,'',0,'',NULL,0); 
     
    4139INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (8,'name','childproducts.partname','left','',1,'',1,'100%',NULL,0); 
    4240INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (8,'part number','childproducts.partnumber','left','',0,'',0,'',NULL,0); 
    43 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (18,'id','clients.id','center','',0,'',0,'',NULL,0); 
    44 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (18,'type','if(clients.type=\"prospect\",\"<span style=\'color:red;\'>P</span>\",\"<b>C</b>\")','left','',1,NULL,0,'','noencoding',0); 
    45 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (18,'company / name','if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company)','left','',2,'',1,'100%',NULL,0); 
    46 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (18,'city','clients.city','left','',3,'',0,'',NULL,0); 
    47 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (18,'state','clients.state','center','',4,'',0,'',NULL,0); 
    48 INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (18,'postal code','clients.postalcode','left','',5,'',0,'',NULL,0); 
     41INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'id', 'clients.id', 'center', '', '0', '', '0', '', NULL, '0'); 
     42INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'type', 'clients.type', 'left', '', '1', '', '0', '', NULL, '0'); 
     43INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'name', 'IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\'))', 'left', '', '2', 'concat(clients.company,clients.lastname,clients.firstname)', '1', '100%', NULL, '0'); 
    4944INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (22,'name','clientemailprojects.name','left','',0,'',0,'100%',NULL,0); 
    5045INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (22,'last run','clientemailprojects.lastrun','right','',1,'',0,'','datetime',0); 
     
    7772INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'date','receipts.receiptdate','left','',3,'',0,'','date',0); 
    7873INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES (304,'status','receipts.status','left','',2,'',0,'',NULL,0); 
     74INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'address', 'concat(if(addresses.title != \'\',concat(\'[b]\',addresses.title,\'[/b][br]\'),\'\'),addresses.address1,if(addresses.address2 != \'\',concat(\'[br]\', addresses.address2),\'\'),if(addresses.city != \'\',concat(\'[br]\',addresses.city,\', \',if(addresses.state != \'\',addresses.state, \'\'),\' \',if(addresses.postalcode != \'\', addresses.postalcode, \'\')),\'\'),if(addresses.country != \'\',concat(\'[br]\',addresses.country),\'\'))', 'left', '', '0', '', '1', '100%', 'bbcode', '0'); 
     75INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'default ship to', 'addresstorecord.defaultshipto', 'center', '', '4', '', '0', '', 'boolean', '0'); 
     76INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'ship to name', 'addresses.shiptoname', 'left', '', '3', '', '0', '', NULL, '0'); 
     77INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'phone', 'addresses.phone', 'left', '', '2', '', '0', '', NULL, '0'); 
     78INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'email', 'addresses.email', 'left', '', '1', '', '0', '', NULL, '0'); 
     79INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'primary', 'addresstorecord.primary', 'center', '', '5', '', '0', '', 'boolean', '0'); 
     80INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('306', 'id', 'addresses.id', 'left', '', '0', '', '0', '', NULL, '0'); 
  • trunk/phpbms/modules/bms/install/tabledefs.sql

    r384 r385  
    1 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES (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()); 
    2 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('2', 'Clients', 'table', '2', 'clients', '((clients INNER JOIN addresstorecord on clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON  addresstorecord.addressid = addresses.id)', 'modules/bms/clients_addedit.php', '0', 'modules/bms/clients_addedit.php', '0', '0', '-100', '-100', 'inactivate', 'clients.id=-100', 'concat(clients.lastname,\", \",clients.firstname)', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
     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 ('2', 'Clients', 'table', '2', 'clients', '((clients INNER JOIN addresstorecord on clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON  addresstorecord.addressid = addresses.id)', 'modules/bms/clients_addedit.php', '0', 'modules/bms/clients_addedit.php', '0', '0', '-100', '-100', 'inactivate', 'clients.id=-100', 'clients.company, clients.lastname, clients.firstname', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
    32INSERT 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,'Sales Orders','table',2,'invoices','(((invoices INNER JOIN clients ON invoices.clientid=clients.id) INNER JOIN invoicestatuses ON invoices.statusid=invoicestatuses.id) LEFT JOIN paymentmethods ON invoices.paymentmethodid = paymentmethods.id)','modules/bms/invoices_addedit.php',0,'modules/bms/invoices_addedit.php',0,0,-100,-100,'void','invoices.type+0<3 OR (invoices.type = \'Invoice\' AND invoices.totalti != invoices.amountpaid)','invoices.id','','','',1,NOW(),1,NOW()); 
    43INSERT 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()); 
     
    1413INSERT 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 ('303', 'AR Items', 'table', '2', 'aritems', '(aritems INNER JOIN clients ON aritems.clientid = clients.id)', 'modules/bms/aritems_view.php', '0', 'NA', '0', '0', '-100', '-100', 'NA', 'aritems.posted=1 AND aritems.status = \'open\'', 'aritems.itemdate, aritems.status, aritems.id', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
    1514INSERT 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 ('304', 'Receipts', 'table', '2', 'receipts', '((receipts INNER JOIN clients ON receipts.clientid = clients.id) LEFT JOIN paymentmethods ON receipts.paymentmethodid = paymentmethods.id)', 'modules/bms/receipts_addedit.php', '80', 'modules/bms/receipts_addedit.php', '80', '80', '-100', '-100', 'delete', 'receipts.posted=0', 'receipts.receiptdate', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
     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 ('305', 'Client Addresses', 'view', '2', 'addresstorecord', '((addresstorecord INNER JOIN addresses ON addresstorecord.addressid = addresses.id) INNER JOIN clients ON addresstorecord.recordid = clients.id)', 'modules/bms/addresses_addedit.php', '0', 'modules/bms/addresses_addedit.php', '0', '0', '-100', '-100', 'remove', 'addresstorecord.tabledefid=2 AND addresstorecord.id = -100', 'addresstorecord.primary DESC,  addresstorecord.defaultshipto DESC,  addresses.title,  addresses.address1', NULL, NULL, NULL, 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 ('306', 'Addresses', 'table', '2', 'addresses', 'addresses', 'modules/bms/addresses_addedit.php', '0', 'modules/bms/addresses_addedit.php', '0', '0', '-100', '-100', 'delete', 'addresses.id != -100', 'address.title', NULL, NULL, NULL, 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 ('18', 'Client Duplicates', 'view', '2', 'clients', '((clients INNER JOIN addresstorecord on clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON addresstorecord.addressid = addresses.id),((clients AS dclients INNER JOIN addresstorecord as daddresstorecord on dclients.id = daddresstorecord.recordid AND daddresstorecord.tabledefid=2 AND daddresstorecord.primary=1) INNER JOIN addresses AS daddresses ON daddresstorecord.addressid = daddresses.id)', 'N/A', '0', 'N/A', '0', '0', '-100', '-100', 'NA', 'clients.id = -100', 'clients.company, clients.lastname, clients.firstname', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
  • trunk/phpbms/modules/bms/install/tablefindoptions.sql

    r320 r385  
    1 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (2,'Prospects','clients.type = \"prospect\"   and clients.inactive=0',1,0); 
    2 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (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` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (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` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (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` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (2,'Clients','clients.type = \"client\" and clients.inactive=0',0,0); 
    6 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (2,'Inactive Clients','clients.type = \"client\" and clients.inactive=1',6,0); 
    7 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (2,'All Records','clients.id != 0',7,0); 
     1INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Prospects', 'clients.type = \"prospect\"   and clients.inactive=0', '1', '0'); 
     2INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('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` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('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` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('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` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Clients', 'clients.type = \"client\" and clients.inactive=0', '0', '0'); 
     6INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Inactive Clients', 'clients.type = \"client\" and clients.inactive=1', '6', '0'); 
     7INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'All Records', 'clients.id != 0', '7', '0'); 
    88INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (3,'Orders - Ready To Post','invoices.type = \'Order\' AND invoices.readytopost =1',8,30); 
    99INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (3,'Orders - No Payment','invoices.type = \'Order\' AND invoices.paymentmethodid IS NULL or invoices.paymentmethodid = 0',9,20); 
     
    4949INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (7,'Inactive Records','productcategories.inactive=1',2,0); 
    5050INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (8,'All Records','prerequisites.id != 0',1,0); 
    51 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (18,'matching names','clients.firstname=dupclients.firstname and clients.lastname=dupclients.lastname and clients.id<>dupclients.ID',1,0); 
    52 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (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` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (18,'Matching Addresses','clients.address1=dupclients.address1 and clients.id<>dupclients.ID',3,0); 
    54 INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (18,'Matching Home Phone','clients.homephone=dupclients.homephone and clients.id<>dupclients.ID',4,0); 
     51INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('18', 'match names', 'clients.firstname=dclients.firstname AND clients.lastname=dclients.lastname AND clients.lastname != \'\' AND clients.firstname != \'\' AND  clients.id<>dclients.id', '1', '0'); 
     52INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('18', 'match names and postal code', 'clients.firstname=dclients.firstname AND clients.lastname=dclients.lastname AND addresses.postalcode = daddresses.postalcode AND clients.lastname != \'\' AND clients.firstname != \'\' AND addresses.postalcode != \'\' AND clients.id<>dlients.ID', '2', '0'); 
     53INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('18', 'match addresses', 'addresses.address1=addresses..address1 AND clients.id<>dclients.id', '3', '0'); 
    5554INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (22,'all records','clientemailprojects.id!=-1',0,0); 
    5655INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (22,'global projects','clientemailprojects.userid=0',1,0); 
     
    7473INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (304,'non-posted','receipts.posted = 0',0,0); 
    7574INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES (304,'posted','receipts.posted = 1',4,0); 
     75INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('305', 'All Records', 'addresstorecord.id!=-1', '0', '0'); 
     76INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('306', 'All Records', 'addresses.id!=-1', '0', '0'); 
  • trunk/phpbms/modules/bms/install/tableoptions.sql

    r318 r385  
    1 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'massEmail', 'send mass e-mail', '1', '0', '100'); 
    2 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'delete_prospects', 'delete prospects', '1', '0', '0'); 
    3 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'stamp_infosent', 'info packet sent', '1', '0', '0'); 
    4 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'mark_asclient', 'convert to client', '1', '0', '50'); 
    5 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'printex', '1', '0', '0', '0'); 
    61INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'new', '1', '0', '0', '0'); 
    72INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'edit', '1', '0', '0', '0'); 
    83INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'select', '1', '0', '0', '0'); 
     4INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'massEmail', 'send mass e-mail', '1', '0', '100'); 
     5INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'mark_asclient', 'convert to client', '1', '0', '50'); 
     6INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'stamp_infosent', 'info packet sent', '1', '0', '0'); 
     7INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'delete_prospects', 'delete prospects', '1', '0', '0'); 
     8INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'printex', '1', '0', '0', '0'); 
    99INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('3', 'email_invoice', 'e-mail client invoice PDF', '1', '20', '100'); 
    1010INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('3', 'mark_asinvoice', 'post as invoice', '1', '30', '50'); 
     
    3737INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('8', 'edit', '0', '0', '0', '0'); 
    3838INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('8', 'printex', '1', '0', '0', '0'); 
     39INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'new', '0', '0', '0', '0'); 
     40INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'edit', '0', '0', '0', '0'); 
     41INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'select', '1', '0', '0', '0'); 
    3942INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'delete_prospects', 'delete prospects', '0', '0', '0'); 
    40 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'select', '1', '0', '0', '0'); 
    41 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'edit', '0', '0', '0', '0'); 
    42 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'new', '0', '0', '0', '0'); 
    4343INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('22', 'edit', '1', '0', '0', '0'); 
    4444INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('22', 'select', '1', '0', '0', '0'); 
     
    7373INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('304', 'post', 'post receipt', '1', '30', '100'); 
    7474INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('304', 'mark_collected', 'mark as collected', '1', '0', '0'); 
     75INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'new', '1', '0', '0', '0'); 
     76INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'edit', '1', '0', '0', '0'); 
     77INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'printex', '0', '0', '0', '0'); 
     78INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'select', '1', '0', '0', '0'); 
     79INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'markDefaultShipTo', 'mark default ship to', '1', '0', '0'); 
     80INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'markPrimary', 'mark primary address', '1', '0', '0'); 
     81INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'new', '1', '0', '0', '0'); 
     82INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'edit', '1', '0', '0', '0'); 
     83INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'printex', '1', '0', '0', '0'); 
     84INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'select', '1', '0', '0', '0'); 
  • trunk/phpbms/modules/bms/install/tablesearchablefields.sql

    r311 r385  
    1 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',0,'whereclause'); 
    2 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")','phone',1,'whereclause'); 
    3 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'clients.city','city',2,'field'); 
    4 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'clients.state','state',3,'field'); 
    5 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'clients.postalcode','postal code',4,'field'); 
    6 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'clients.email','e-mail',5,'field'); 
    7 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'clients.leadsource','lead source',6,'field'); 
    8 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (2,'clients.id','id',7,'field'); 
     1INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', '(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")', ' name', '0', 'whereclause'); 
     2INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.id', 'id', '7', 'field'); 
     3INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.leadsource', 'lead source', '6', 'field'); 
     4INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'clients.email', 'e-mail', '5', 'field'); 
     5INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.postalcode', 'postal code', '4', 'field'); 
     6INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.state', 'state/province', '3', 'field'); 
     7INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', 'addresses.city', 'city', '2', 'field'); 
     8INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('2', '(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")', 'phone', '1', 'whereclause'); 
    99INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,'invoices.orderdate','order date',2,'field'); 
    1010INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (3,'invoices.invoicedate','invoice date',3,'field'); 
     
    3030INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,'childproducts.partname','dependent name',3,'field'); 
    3131INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (8,'prerequisites.id','id',4,'field'); 
    32 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,'(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")','company / name',0,'whereclause'); 
    33 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,'(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")','phone',1,'whereclause'); 
    34 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,'clients.city','city',2,'field'); 
    35 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,'clients.state','state',3,'field'); 
    36 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,'clients.postalcode','postal code',4,'field'); 
    37 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,'clients.email','e-mail',5,'field'); 
    38 INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (18,'clients.id','id',6,'field'); 
     32INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', '(clients.lastname like \"{{value}}%\" or clients.firstname like \"{{value}}%\" or clients.company like \"{{value}}%\")', 'name', '0', 'whereclause'); 
     33INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', '(clients.homephone like \"{{value}}%\" or clients.workphone like \"{{value}}%\" or clients.mobilephone like \"{{value}}%\" or clients.otherphone like \"{{value}}%\" or clients.fax like \"{{value}}%\")', 'phone', '1', 'whereclause'); 
     34INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', 'clients.email', 'e-mail', '5', 'field'); 
     35INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('18', 'clients.id', 'id', '6', 'field'); 
    3936INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (22,'clientemailprojects.name','name',0,'field'); 
    4037INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (22,'users.firstname like \"{{value}}%\" or users.lastname like \"{{value}}%\"','user',1,'whereclause'); 
     
    5148INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (304,'paymentmethods.name','payment',3,'field'); 
    5249INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES (304,'receipts.amount','amount',4,'field'); 
     50INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('305', 'addresstorecord.id', 'id', '1', 'field'); 
     51INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) VALUES ('306', 'addresses.id', 'id', '1', 'field'); 
  • trunk/phpbms/modules/bms/install/updatev0.96.sql

    r384 r385  
    1010INSERT INTO `smartsearches` (`id`, `name`, `fromclause`, `valuefield`, `displayfield`, `secondaryfield`, `classfield`, `searchfields`, `filterclause`, `rolefield`, `tabledefid`, `moduleid`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('8', 'Pick Client By Phone', 'clients', 'clients.id', 'IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\'))', 'CONCAT(IF(clients.workphone != \'\',CONCAT(clients.workphone,\' (w)[br]\'),\'\'),IF(clients.homephone != \'\',CONCAT(clients.homephone,\' (h)[br]\'),\'\'),IF(clients.mobilephone != \'\',CONCAT(clients.mobilephone,\' (m)[br]\'),\'\'),IF(clients.otherphone != \'\',CONCAT(clients.otherphone,\' (o)[br]\'),\'\'),IF(clients.fax != \'\',CONCAT(clients.fax,\' (fax)\'),\'\'))', 'clients.type', 'clients.workphone, clients.homephone, clients.mobilephone, clients.otherphone, clients.fax', 'clients.inactive = 0', NULL, '2', '2', 1, NOW(), 1, NOW()); 
    1111INSERT INTO `tabs` (`id`, `name`, `tabgroup`, `location`, `displayorder`, `enableonnew`, `roleid`, `tooltip`, `notificationsql`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('303', 'addresses', 'clients entry', 'modules/bms/clients_addresses.php', '12', '0', '0', NULL, NULL, 1, NOW(), 1, NOW()); 
     12DELETE FROM `tabledefs` WHERE id = 2 or id = 18; 
     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 ('2', 'Clients', 'table', '2', 'clients', '((clients INNER JOIN addresstorecord on clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON  addresstorecord.addressid = addresses.id)', 'modules/bms/clients_addedit.php', '0', 'modules/bms/clients_addedit.php', '0', '0', '-100', '-100', 'inactivate', 'clients.id=-100', 'clients.company, clients.lastname, clients.firstname', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
     14INSERT 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 Duplicates', 'view', '2', 'clients', '((clients INNER JOIN addresstorecord on clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON addresstorecord.addressid = addresses.id),((clients AS dclients INNER JOIN addresstorecord as daddresstorecord on dclients.id = daddresstorecord.recordid AND daddresstorecord.tabledefid=2 AND daddresstorecord.primary=1) INNER JOIN addresses AS daddresses ON daddresstorecord.addressid = daddresses.id)', 'N/A', '0', 'N/A', '0', '0', '-100', '-100', 'NA', 'clients.id = -100', 'clients.company, clients.lastname, clients.firstname', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
     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 ('305', 'Client Addresses', 'view', '2', 'addresstorecord', '((addresstorecord INNER JOIN addresses ON addresstorecord.addressid = addresses.id) INNER JOIN clients ON addresstorecord.recordid = clients.id)', 'modules/bms/addresses_addedit.php', '0', 'modules/bms/addresses_addedit.php', '0', '0', '-100', '-100', 'remove', 'addresstorecord.tabledefid=2 AND addresstorecord.id = -100', 'addresstorecord.primary DESC,  addresstorecord.defaultshipto DESC,  addresses.title,  addresses.address1', NULL, NULL, NULL, 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 ('306', 'Addresses', 'table', '2', 'addresses', 'addresses', 'modules/bms/addresses_addedit.php', '0', 'modules/bms/addresses_addedit.php', '0', '0', '-100', '-100', 'delete', 'addresses.id != -100', 'address.title', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 
     17DELETE FROM `tablecolumns` WHERE tabledefid = 2 OR tabledefid = 18; 
     18INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'e-mail', 'clients.email', 'left', '', '3', '', '0', '', NULL, '0'); 
     19INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'has credit', 'clients.hascredit', 'center', '', '1', '', '0', '', 'boolean', '80'); 
     20INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'name / location', 'CONCAT(\'[b]\',IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\')),\'[/b][br][space]\', IF(addresses.city != \'\' OR addresses.state !=\'\' OR addresses.postalcode != \'\', CONCAT(IF(addresses.city != \'\',addresses.city,\'\'),\', \',IF(addresses.state != \'\', addresses.state, \'\'),\' \',IF(addresses.postalcode != \'\', addresses.postalcode, \'\')),\'(no location)\'))', 'left', '', '2', 'concat(clients.company,clients.lastname,clients.firstname)', '0', '100%', 'bbcode', '0'); 
     21INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'type', 'clients.type', 'left', '', '0', '', '0', '', NULL, '0'); 
     22INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('2', 'phone', 'IF(clients.workphone != \'\' OR clients.homephone != \'\' OR clients.mobilephone != \'\' OR clients.otherphone != \'\',IF(clients.workphone != \'\', concat(clients.workphone, \' (w)\'), IF(clients.homephone != \'\', concat(clients.homephone, \' (h)\'), IF(clients.mobilephone != \'\', concat(clients.mobilephone, \' (m)\'), IF(clients.otherphone != \'\', concat(clients.otherphone, \' (o)\'), \'\')))) ,\'\')', 'left', '', '4', 'concat(clients.workphone, clients.homephone, clients.mobilephone,clients.otherphone)', '0', '', NULL, '0'); 
     23INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'id', 'clients.id', 'center', '', '0', '', '0', '', NULL, '0'); 
     24INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'type', 'clients.type', 'left', '', '1', '', '0', '', NULL, '0'); 
     25INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('18', 'name', 'IF(clients.company != \'\', CONCAT(clients.company,IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(\' (\',if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\'),\')\'), \'\')), IF(clients.lastname != \'\' OR clients.firstname != \'\', CONCAT(if(clients.lastname != \'\', clients.lastname, \'{blank}\'),\', \',if(clients.firstname != \'\', clients.firstname, \'{blank}\')), \'\'))', 'left', '', '2', 'concat(clients.company,clients.lastname,clients.firstname)', '1', '100%', NULL, '0'); 
     26INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'address', 'concat(if(addresses.title != \'\',concat(\'[b]\',addresses.title,\'[/b][br]\'),\'\'),addresses.address1,if(addresses.address2 != \'\',concat(\'[br]\', addresses.address2),\'\'),if(addresses.city != \'\',concat(\'[br]\',addresses.city,\', \',if(addresses.state != \'\',addresses.state, \'\'),\' \',if(addresses.postalcode != \'\', addresses.postalcode, \'\')),\'\'),if(addresses.country != \'\',concat(\'[br]\',addresses.country),\'\'))', 'left', '', '0', '', '1', '100%', 'bbcode', '0'); 
     27INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'default ship to', 'addresstorecord.defaultshipto', 'center', '', '4', '', '0', '', 'boolean', '0'); 
     28INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'ship to name', 'addresses.shiptoname', 'left', '', '3', '', '0', '', NULL, '0'); 
     29INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'phone', 'addresses.phone', 'left', '', '2', '', '0', '', NULL, '0'); 
     30INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'email', 'addresses.email', 'left', '', '1', '', '0', '', NULL, '0'); 
     31INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('305', 'primary', 'addresstorecord.primary', 'center', '', '5', '', '0', '', 'boolean', '0'); 
     32INSERT INTO `tablecolumns` (`tabledefid`, `name`, `column`, `align`, `footerquery`, `displayorder`, `sortorder`, `wrap`, `size`, `format`, `roleid`) VALUES ('306', 'id', 'addresses.id', 'left', '', '0', '', '0', '', NULL, '0'); 
     33DELETE FROM `tablefindoptions` WHERE tabledefid = 2 OR tabledefid = 18; 
     34INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Prospects', 'clients.type = \"prospect\"   and clients.inactive=0', '1', '0'); 
     35INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Today\'s Prospects', 'clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate))=0 and clients.inactive=0', '3', '0'); 
     36INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Yesterday\'s Prospects', 'clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate))=1 and clients.inactive=0', '4', '0'); 
     37INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Last Week\'s Prospects', 'clients.type = \"prospect\" and (TO_DAYS(now())-TO_DAYS(clients.creationdate))<7 and clients.inactive=0', '5', '0'); 
     38INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Clients', 'clients.type = \"client\" and clients.inactive=0', '0', '0'); 
     39INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'Inactive Clients', 'clients.type = \"client\" and clients.inactive=1', '6', '0'); 
     40INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('2', 'All Records', 'clients.id != 0', '7', '0'); 
     41INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('18', 'match names', 'clients.firstname=dclients.firstname AND clients.lastname=dclients.lastname AND clients.lastname != \'\' AND clients.firstname != \'\' AND  clients.id<>dclients.id', '1', '0'); 
     42INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('18', 'match names and postal code', 'clients.firstname=dclients.firstname AND clients.lastname=dclients.lastname AND addresses.postalcode = daddresses.postalcode AND clients.lastname != \'\' AND clients.firstname != \'\' AND addresses.postalcode != \'\' AND clients.id<>dlients.ID', '2', '0'); 
     43INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('18', 'match addresses', 'addresses.address1=addresses..address1 AND clients.id<>dclients.id', '3', '0'); 
     44INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('305', 'All Records', 'addresstorecord.id!=-1', '0', '0'); 
     45INSERT INTO `tablefindoptions` (`tabledefid`, `name`, `search`, `displayorder`, `roleid`) VALUES ('306', 'All Records', 'addresses.id!=-1', '0', '0'); 
     46DELETE FROM `tableoptions` WHERE tabledefid = 2 OR tabledefid = 18; 
     47INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'new', '1', '0', '0', '0'); 
     48INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'edit', '1', '0', '0', '0'); 
     49INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'select', '1', '0', '0', '0'); 
     50INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'massEmail', 'send mass e-mail', '1', '0', '100'); 
     51INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'mark_asclient', 'convert to client', '1', '0', '50'); 
     52INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'stamp_infosent', 'info packet sent', '1', '0', '0'); 
     53INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'delete_prospects', 'delete prospects', '1', '0', '0'); 
     54INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('2', 'printex', '1', '0', '0', '0'); 
     55INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'new', '0', '0', '0', '0'); 
     56INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'edit', '0', '0', '0', '0'); 
     57INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'select', '1', '0', '0', '0'); 
     58INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('18', 'delete_prospects', 'delete prospects', '0', '0', '0'); 
     59INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'new', '1', '0', '0', '0'); 
     60INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'edit', '1', '0', '0', '0'); 
     61INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'printex', '0', '0', '0', '0'); 
     62INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'select', '1', '0', '0', '0'); 
     63INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'markDefaultShipTo', 'mark default ship to', '1', '0', '0'); 
     64INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('305', 'markPrimary', 'mark primary address', '1', '0', '0'); 
     65INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'new', '1', '0', '0', '0'); 
     66INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'edit', '1', '0', '0', '0'); 
     67INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `othercommand`, `roleid`, `displayorder`) VALUES ('306', 'printex', '1