Changeset 515
- Timestamp:
- 05/05/09 12:26:06 (3 years ago)
- Location:
- trunk/phpbms
- Files:
-
- 15 modified
-
include/imports.php (modified) (4 diffs)
-
include/session.php (modified) (1 diff)
-
include/tables.php (modified) (2 diffs)
-
install/tableoptions.sql (modified) (1 diff)
-
modules/base/general_import.php (modified) (4 diffs)
-
modules/base/include/files.php (modified) (1 diff)
-
modules/base/include/notes.php (modified) (1 diff)
-
modules/base/include/roles.php (modified) (3 diffs)
-
modules/base/include/tabledefs.php (modified) (1 diff)
-
modules/base/include/users.php (modified) (1 diff)
-
modules/bms/clients_import.php (modified) (3 diffs)
-
modules/bms/include/addresstorecord.php (modified) (2 diffs)
-
modules/bms/include/invoices.php (modified) (2 diffs)
-
modules/bms/include/receipts.php (modified) (1 diff)
-
modules/bms/install/tabledefs.sql (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/include/imports.php
r485 r515 16 16 var $pageType = "main"; 17 17 18 18 19 function phpbmsImport($table, $importType = "csv"){ 19 20 … … 31 32 //Won't display db errors, just log them. 32 33 $this->table->db->showError = false; 33 if(isset($_POST["pageType"]))34 $this->pageType = $_POST["pageType"];35 36 if(isset($_POST["tempFileID"]))37 $this->tempFileID = ((int)$_POST["tempFileID"]);38 34 39 35 }//end method --imports-- … … 258 254 $verify = $this->table->verifyVariables($trimmedRowData); 259 255 if(!count($verify)) 260 $theid = $this->table->insertRecord($trimmedRowData );256 $theid = $this->table->insertRecord($trimmedRowData, NULL, true); 261 257 }else 262 258 $this->error .= '<li> incorrect amount of fields for line number '.$rowNum.'.</li>'; … … 332 328 $this->table->getTableInfo(); 333 329 330 if(isset($_POST["pageType"])) 331 $this->pageType = $_POST["pageType"]; 332 333 if(isset($_POST["tempFileID"])) 334 $this->tempFileID = ((int)$_POST["tempFileID"]); 335 334 336 if(!isset($_POST["command"])){ 335 337 -
trunk/phpbms/include/session.php
r485 r515 515 515 $error = new appError(-353,"You must remove the install directory and all modules' install directories before phpBMS can run.","Main Install Directory Present",true,true,true,$errorFormat); 516 516 517 $thedir= @ opendir("modules"); 518 519 while($entry = readdir($thedir)){ 520 521 if($entry != "." && $entry != ".." && $entry != "base" && $entry != "sample" && is_dir("modules/".$entry)){ 522 523 if(file_exists("modules/".$entry."/install") && is_dir("modules/".$entry."/install")){ 524 525 $error = new appError(-354,"You must remove the install directory and all modules' install directories before phpBMS can run.","Module '".$entry."' Install Directory Present",true,true,true,$errorFormat); 517 if(file_exists("modules") && is_dir("modules")){ 518 519 $thedir = @ opendir("modules"); 520 521 while($entry = readdir($thedir)){ 522 523 if($entry != "." && $entry != ".." && $entry != "base" && $entry != "sample" && is_dir("modules/".$entry)){ 524 525 if(file_exists("modules/".$entry."/install") && is_dir("modules/".$entry."/install")){ 526 527 $error = new appError(-354,"You must remove the install directory and all modules' install directories before phpBMS can run.","Module '".$entry."' Install Directory Present",true,true,true,$errorFormat); 528 529 }//endif 526 530 527 531 }//endif 528 532 529 }//end if533 }//end while 530 534 531 535 }//end if -
trunk/phpbms/include/tables.php
r513 r515 345 345 346 346 347 function insertRecord($variables,$createdby = NULL, $overrideID = false ){347 function insertRecord($variables,$createdby = NULL, $overrideID = false, $replace = false){ 348 348 349 349 if($createdby === NULL) … … 396 396 $insertvalues = substr($insertvalues, 0, strlen($insertvalues)-2); 397 397 398 $insertstatement = "INSERT INTO ".$this->maintable." (".$fieldlist.") VALUES (".$insertvalues.")"; 398 if($replace) 399 $insertstatement = "REPLACE"; 400 else 401 $insertstatement = "INSERT"; 402 403 $insertstatement .= " INTO ".$this->maintable." (".$fieldlist.") VALUES (".$insertvalues.")"; 399 404 $insertresult = $this->db->query($insertstatement); 400 405 -
trunk/phpbms/install/tableoptions.sql
r495 r515 89 89 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('205', 'printex', '1', '0', '0', '0', '0'); 90 90 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('205', 'select', '1', '0', '0', '0', '0'); 91 INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`, `displayorder`) VALUES ('205', 'import', '1', '0', '0', '-100', '0'); -
trunk/phpbms/modules/base/general_import.php
r485 r515 91 91 $pageTitle = ($therecord["title"])?$therecord["title"]:"General Table Import"; 92 92 93 // Next, we set up to include any94 // additional css or javascript files we will be using95 // This does nto include any field-type specific js (like datepicker)96 // as they are automatically icluded when you define the special fields you97 // will be using below.98 93 $phpbms->cssIncludes[] = "pages/imports.css"; 99 94 //$phpbms->jsIncludes[] = "modules/[modulename]/javascript/[tablename].js"; 100 95 101 // if you need to define a body onlload function, do so with the phpbms property102 103 // $phpbms->onload[] = "initializePage()";104 105 106 // Next we need to define any special fields that will be used in the form107 // A list of field objects (with documentation)is available in the /include/fields.php108 // file.109 110 // We need to define them here in the head111 // so that any necessay javascript is loaded appropriately.112 96 113 97 //Form Elements … … 117 101 $theform = new importForm(); 118 102 $theform->enctype = "multipart/form-data"; 119 //if you need to set specific form vaiables (like enctype, or extra onsubmit120 // you can set those form properties here.121 122 103 123 104 // lastly, use the jsMerge method to create the final Javascript formatting … … 153 134 </p> 154 135 136 155 137 <div id="info0" class="info"> 156 138 <p> … … 172 154 (e.g. use English, US style dates if that is what the bms is configured to). 173 155 </p> 156 174 157 </div> 175 158 </div> -
trunk/phpbms/modules/base/include/files.php
r485 r515 135 135 136 136 137 function insertRecord($variables, $createdby = NULL ){137 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 138 138 139 $newid = parent::insertRecord($variables, $createdby );139 $newid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 140 140 141 141 //restore the fields -
trunk/phpbms/modules/base/include/notes.php
r485 r515 785 785 786 786 787 function insertRecord($variables, $createdby = NULL ){788 789 $newid = parent::insertRecord($variables, $createdby );787 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 788 789 $newid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 790 790 791 791 if(isset($variables["completed"]) && isset($variables["repeating"])) -
trunk/phpbms/modules/base/include/roles.php
r485 r515 39 39 if(class_exists("phpbmsTable")){ 40 40 class roles extends phpbmsTable{ 41 42 function updateRecord($variables, $modifiedby = NULL){ 41 42 function updateRecord($variables, $modifiedby = NULL){ 43 43 parent::updateRecord($variables, $modifiedby); 44 44 … … 46 46 $this->assignUsers($variables["id"],$variables["newusers"]); 47 47 } 48 49 50 function insertRecord($variables, $createdby = NULL ){51 $theid = parent::insertRecord($variables, $createdby );52 48 49 50 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 51 $theid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 52 53 53 if(isset($variables["userschanged"])) 54 54 if($variables["userschanged"]==1) 55 55 $this->assignUsers($theid,$variables["newusers"]); 56 56 57 57 return $theid; 58 58 } 59 60 59 60 61 61 function assignUsers($id,$users){ 62 62 $querystatement="DELETE FROM rolestousers WHERE roleid=".$id; 63 63 $queryresult=$this->db->query($querystatement); 64 64 65 65 $newusers=explode(",",$users); 66 66 67 67 foreach($newusers as $theuser) 68 68 if($theuser!=""){ … … 71 71 } 72 72 } 73 74 73 74 75 75 function displayUsers($id,$type){ 76 76 $querystatement="SELECT users.id,concat(users.firstname,' ',users.lastname) as name 77 FROM users INNER JOIN rolestousers ON rolestousers.userid=users.id 77 FROM users INNER JOIN rolestousers ON rolestousers.userid=users.id 78 78 WHERE rolestousers.roleid=".((int) $id); 79 79 $assignedquery=$this->db->query($querystatement); 80 80 81 81 $thelist=array(); 82 82 83 83 if($type=="available"){ 84 84 $excludelist=array(); 85 85 while($therecord=$this->db->fetchArray($assignedquery)) 86 86 $excludelist[]=$therecord["id"]; 87 87 88 88 $querystatement="SELECT id,concat(users.firstname,' ',users.lastname) as name FROM users WHERE revoked=0 AND portalaccess=0"; 89 89 $availablequery=$this->db->query($querystatement); 90 90 91 91 while($therecord=$this->db->fetchArray($availablequery)) 92 92 if(!in_array($therecord["id"],$excludelist)) 93 $thelist[]=$therecord; 94 } else 93 $thelist[]=$therecord; 94 } else 95 95 while($therecord=$this->db->fetchArray($assignedquery)) 96 96 $thelist[]=$therecord; 97 97 98 98 foreach($thelist as $theoption){ 99 99 ?> <option value="<?php echo $theoption["id"]?>"><?php echo htmlQuotes($theoption["name"])?></option> 100 <?php 100 <?php 101 101 } 102 102 }//end function 103 103 104 104 }//end class 105 105 }//end if -
trunk/phpbms/modules/base/include/tabledefs.php
r510 r515 325 325 326 326 $querystatement = "INSERT INTO `tableoptions` (`tabledefid`, `name`, `option`, `needselect`, `othercommand`, `roleid`) 327 VALUES (".$newid.",'import',' 1',0,0,'-100');";327 VALUES (".$newid.",'import','0',0,0,'-100');"; 328 328 $this->db->query($querystatement); 329 329 -
trunk/phpbms/modules/base/include/users.php
r491 r515 147 147 148 148 149 function insertRecord($variables, $createdby = NULL ){149 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 150 150 151 151 $this->fields["password"]["type"] = "password"; 152 152 unset($this->fields["lastlogin"]); 153 153 154 $theid = parent::insertRecord($variables, $createdby );154 $theid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 155 155 156 156 //reset field information -
trunk/phpbms/modules/bms/clients_import.php
r485 r515 96 96 $thetable = new clients($db,2,$backurl); 97 97 $import = new clientsImport($thetable, $importType); 98 99 //and if you are setting the backurl, make sure you pass that as well 100 // like this: 101 102 // $thetable = new [tablename]($db,[table definition id],$backurl); 103 104 98 105 99 //Next we process the form (if submitted) and 106 100 // return the current record as an array ($therecord) … … 115 109 $pageTitle = ($therecord["title"])?$therecord["title"]:"General Table Import"; 116 110 117 // Next, we set up to include any118 // additional css or javascript files we will be using119 // This does nto include any field-type specific js (like datepicker)120 // as they are automatically icluded when you define the special fields you121 // will be using below.122 111 $phpbms->cssIncludes[] = "pages/imports.css"; 123 112 $phpbms->jsIncludes[] = "modules/bms/javascript/clients_import.js"; 124 113 125 // if you need to define a body onlload function, do so with the phpbms property126 127 // $phpbms->onload[] = "initializePage()";128 129 130 // Next we need to define any special fields that will be used in the form131 // A list of field objects (with documentation)is available in the /include/fields.php132 // file.133 114 134 115 // We need to define them here in the head … … 154 135 $theform->addField($theinput); 155 136 156 // if you neeed to add additional attributes toa field, it's easy.157 //$theinput = new inputBasicList("type",$therecord["type"],array("Quote"=>"Quote","Order"=>"Order","Invoice"=>"Invoice","VOID"=>"VOID"), $displayName = NULL, $displayLabel = true);158 //$theinput->setAttribute("onchange","checkType(this)");159 //$theinput->setAttribute("class","important");160 //$theform->addField($theinput);161 137 162 138 // lastly, use the jsMerge method to create the final Javascript formatting -
trunk/phpbms/modules/bms/include/addresstorecord.php
r485 r515 245 245 246 246 247 function insertRecord($variables, $createdby = NULL ){247 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 248 248 249 249 //$variables = $this->prepareVariables($variables); … … 257 257 } else { 258 258 259 $newid = parent::insertRecord($variables, $createdby );259 $newid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 260 260 261 261 //create the addresstorecord -
trunk/phpbms/modules/bms/include/invoices.php
r503 r515 769 769 770 770 771 function insertRecord($variables, $createdby = NULL ){771 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 772 772 773 773 if($createdby === NULL) … … 776 776 //$variables = $this->prepareVariables($variables); 777 777 778 $newid = parent::insertRecord($variables, $createdby );778 $newid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 779 779 780 780 if($variables["billingsaveoptions"] != "orderOnly" || $variables["shiptosaveoptions"] != "orderOnly"){ -
trunk/phpbms/modules/bms/include/receipts.php
r501 r515 403 403 404 404 405 function insertRecord($variables, $createdby = NULL ){406 407 $newid = parent::insertRecord($variables, $createdby );405 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false){ 406 407 $newid = parent::insertRecord($variables, $createdby, $overrideID, $replace); 408 408 409 409 if($variables["itemschanged"]==1){ -
trunk/phpbms/modules/bms/install/tabledefs.sql
r506 r515 1 1 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `canpost`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('2', 'Clients', 'table', '2', 'clients', '((clients INNER JOIN addresstorecord on clients.id = addresstorecord.recordid AND addresstorecord.tabledefid=2 AND addresstorecord.primary=1) INNER JOIN addresses ON addresstorecord.addressid = addresses.id)', 'modules/bms/clients_addedit.php', '0', 'modules/bms/clients_addedit.php', '0', 'modules/bms/clients_import.php', '-100', '0', '-100', '-100', 'inactivate', '0', 'clients.id=-100', 'clients.company, clients.lastname, clients.firstname', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 2 2 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `canpost`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('3', 'Sales Orders', 'table', '2', 'invoices', '(((invoices INNER JOIN clients ON invoices.clientid=clients.id) INNER JOIN invoicestatuses ON invoices.statusid=invoicestatuses.id) LEFT JOIN paymentmethods ON invoices.paymentmethodid = paymentmethods.id)', 'modules/bms/invoices_addedit.php', '0', 'modules/bms/invoices_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'void', '1', 'invoices.type+0<3 OR (invoices.type = \'Invoice\' AND invoices.totalti != invoices.amountpaid)', 'invoices.id', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 3 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `canpost`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('4', 'Products', 'table', '2', 'products', '(products inner join productcategories on products.categoryid=productcategories.id)', 'modules/bms/products_addedit.php', '0', 'modules/bms/products_addedit.php', '0', ' modules/bms/products_import.php', '-100', '0', '-100', '-100', 'inactivate', '0', 'products.id =-100', 'products.partnumber', NULL, NULL, NULL, 1, NOW(), 1, NOW());3 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `canpost`, `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', '', '-100', '0', '-100', '-100', 'inactivate', '0', 'products.id =-100', 'products.partnumber', NULL, NULL, NULL, 1, NOW(), 1, NOW()); 4 4 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `canpost`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('5', 'Line Items', 'table', '2', 'lineitems', '((lineitems left join products on lineitems.productid=products.id) inner join invoices on lineitems.invoiceid=invoices.id)', 'N/A', '0', 'N/A', '0', NULL, '-100', '0', '-100', '-100', 'NA', '0', 'lineitems.id =-1', 'lineitems.invoiceid,lineitems.id', '', '', '', 1, NOW(), 1, NOW()); 5 5 INSERT INTO `tabledefs` (`id`, `displayname`, `type`, `moduleid`, `maintable`, `querytable`, `editfile`, `editroleid`, `addfile`, `addroleid`, `importfile`, `importroleid`, `searchroleid`, `advsearchroleid`, `viewsqlroleid`, `deletebutton`, `canpost`, `defaultwhereclause`, `defaultsortorder`, `defaultsearchtype`, `defaultcriteriafindoptions`, `defaultcriteriaselection`, `createdby`, `creationdate`, `modifiedby`, `modifieddate`) VALUES ('6', 'Tax Areas', 'table', '2', 'tax', 'tax', 'modules/bms/tax_addedit.php', '0', 'modules/bms/tax_addedit.php', '0', NULL, '-100', '0', '-100', '-100', 'inactivate', '0', 'tax.inactive=0', 'tax.name', NULL, NULL, NULL, 1, NOW(), 1, NOW());