Changeset 645 for trunk/phpbms/modules
- Timestamp:
- 10/06/09 13:20:39 (3 years ago)
- Location:
- trunk/phpbms/modules
- Files:
-
- 13 modified
-
api/include/apiclass.php (modified) (15 diffs)
-
api/install/createtables.sql (modified) (1 diff)
-
api/install/install.php (modified) (1 diff)
-
base/cron.php (modified) (3 diffs)
-
base/include/scheduler.php (modified) (5 diffs)
-
base/include/tabledefs.php (modified) (2 diffs)
-
base/include/tabledefs_options_include.php (modified) (12 diffs)
-
base/javascript/tableoptions.js (modified) (3 diffs)
-
base/scheduler_addedit.php (modified) (3 diffs)
-
base/smartsearches_addedit.php (modified) (1 diff)
-
base/tabledefs_options.php (modified) (2 diffs)
-
bms/include/clients.php (modified) (1 diff)
-
bms/javascript/invoice.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/api/include/apiclass.php
r641 r645 73 73 74 74 /** 75 * $options 76 * @var object Object containing the current request's options 77 */ 78 var $options; 79 80 /** 75 81 * function api 76 82 * … … 127 133 * encodes data (usually {@link $request}) depending on the {@link $format} 128 134 * 129 * Currently, this function can only decode JSON data, but support for SOAP,135 * Currently, this function can only encode JSON data, but support for SOAP, 130 136 * generic XML, or some other format may be added 131 137 * … … 204 210 }//end function isValidTimeFormat 205 211 212 213 /** 214 * function processOptions 215 * @param array $options 216 */ 217 218 function processOptions($options) { 219 220 $this->options->useUuid = true; 221 if(isset($options["useUuid"])) 222 $this->options->useUuid = (bool)$options["useUuid"]; 223 224 /** 225 * date format options 226 */ 227 228 $this->options->dateFormat = "SQL"; 229 if(defined("DATE_FORMAT")) 230 $this->options->dateFormat = DATE_FORMAT; 231 232 if(isset($options["dateFormat"])) 233 if($this->isValidDateFormat($options["dateFormat"])) 234 $this->options->dateFormat = $options["dateFormat"]; 235 236 /** 237 * Time format options 238 */ 239 240 $this->options->timeFormat = "24 Hour"; 241 if(defined("TIME_FORMAT")) 242 $this->options->timeFormat = TIME_FORMAT; 243 244 if(isset($options["timeFormat"])) 245 if($this->isValidTimeFormat($options["timeFormat"])) 246 $this->options->timeFormat = $options["timeFormat"]; 247 248 /** 249 * Id field options 250 * 251 * This option dictates whether or not to keep the destination's 252 * id field if "replacing" (via the mysql replace) when there is 253 * no id field set. 254 */ 255 $this->options->keepDestId = true; 256 if(isset($options["keepDestId"])) 257 $this->options->keepDestId = (bool)$options["keepDestId"]; 258 259 }//end method --processOptions-- 206 260 207 261 /** … … 221 275 $tabledefid = null; 222 276 223 /**224 * @var bool $useUuid Whether or not to update/get/delete a record using the225 * uuid instead of the id. Default is true.226 */227 $useUuid = true;228 229 277 if(!is_array($this->data)) 230 278 $this->sendError("Passed data malformed. Was expecting an array.", $this->data, true); … … 238 286 $this->sendError("Malformed request number ".$i, $request); 239 287 240 $useUuid = true;241 if(isset($request["options"]["useUuid"]))242 $useUuid = (bool)$request["options"]["useUuid"];243 244 288 /** 245 * date format options289 * Process the options and populate the options object. 246 290 */ 247 248 $dateFormat = "SQL"; 249 if(defined("DATE_FORMAT")) 250 $dateFormat = DATE_FORMAT; 251 252 if(isset($request["options"]["dateFormat"])) 253 if($this->isValidDateFormat($request["options"]["dateFormat"])) 254 $dateFormat = $request["options"]["dateFormat"]; 255 256 /** 257 * Time format options 258 */ 259 260 $timeFormat = "24 Hour"; 261 if(defined("TIME_FORMAT")) 262 $timeFormat = TIME_FORMAT; 263 264 if(isset($request["options"]["dateFormat"])) 265 if($this->isValidTimeFormat($request["options"]["dateFormat"])) 266 $timeFormat = $request["options"]["timeFormat"]; 291 if(!isset($request["options"])) 292 $request["options"] = NULL; 293 294 $this->processOptions($request["options"]); 267 295 268 296 if((int) $request["tabledefid"] !== $tabledefid){ … … 354 382 355 383 $processor = new $className($this->db); 356 $processor->dateFormat = $ dateFormat;357 $processor->timeFormat = $t imeFormat;384 $processor->dateFormat = $this->options->dateFormat; 385 $processor->timeFormat = $this->options->timeFormat; 358 386 359 387 if(!method_exists($processor, $request["command"])) { … … 380 408 if(class_exists($maintable)){ 381 409 $processor = new $maintable($this->db, $tabledefid); 382 $processor->dateFormat = $ dateFormat;383 $processor->timeFormat = $t imeFormat;410 $processor->dateFormat = $this->options->dateFormat; 411 $processor->timeFormat = $this->options->timeFormat; 384 412 }else{ 385 413 $processor = new phpbmsTable($this->db, $tabledefid); 386 $processor->dateFormat = $ dateFormat;387 $processor->timeFormat = $t imeFormat;414 $processor->dateFormat = $this->options->dateFormat; 415 $processor->timeFormat = $this->options->timeFormat; 388 416 } 389 417 … … 439 467 if(class_exists($maintable)){ 440 468 $processor = new $maintable($this->db, $tabledefid); 441 $processor->dateFormat = $ dateFormat;442 $processor->timeFormat = $t imeFormat;469 $processor->dateFormat = $this->options->dateFormat; 470 $processor->timeFormat = $this->options->timeFormat; 443 471 }else{ 444 472 $processor = new phpbmsTable($this->db, $tabledefid); 445 $processor->dateFormat = $ dateFormat;446 $processor->timeFormat = $t imeFormat;473 $processor->dateFormat = $this->options->dateFormat; 474 $processor->timeFormat = $this->options->timeFormat; 447 475 }//end if 448 476 449 477 } else{ 450 478 $processor = new phpbmsTable($this->db, $tabledefid); 451 $processor->dateFormat = $ dateFormat;452 $processor->timeFormat = $t imeFormat;479 $processor->dateFormat = $this->options->dateFormat; 480 $processor->timeFormat = $this->options->timeFormat; 453 481 }//end if 454 482 … … 461 489 $overrideID = false; 462 490 if(is_array($request["data"])) 463 if(isset($request["data"]["id"])) 491 if(isset($request["data"]["id"])){ 492 464 493 if(((int)$request["data"]["id"]) !== 0) 465 494 $overrideID = true; 495 if($this->options->keepDestId && isset($request["data"]["uuid"]) && $this->options->useUuid) 496 $request["data"]["id"] = getId($this->db, $processor->uuid, $request["data"]["uuid"]); 497 498 }elseif($this->options->keepDestId && isset($request["data"]["uuid"]) && $this->options->useUuid) 499 $request["data"]["id"] = getId($this->db, $processor->uuid, $request["data"]["uuid"]); 466 500 467 501 $createUuid = true; … … 471 505 $overrideID = true; 472 506 $createUuid = false; 473 } 507 }//end if 474 508 475 509 if(!isset($processor->fields["uuid"])) 476 510 $createUuid = false; 477 511 478 $newid = $processor->insertRecord($request["data"], null, $overrideID, true, $createUuid);512 $newid = $processor->insertRecord($request["data"], NULL, $overrideID, true, $createUuid); 479 513 480 514 if($newid){ … … 503 537 if(class_exists($maintable)){ 504 538 $processor = new $maintable($this->db, $tabledefid); 505 $processor->dateFormat = $ dateFormat;506 $processor->timeFormat = $t imeFormat;539 $processor->dateFormat = $this->options->dateFormat; 540 $processor->timeFormat = $this->options->timeFormat; 507 541 }else{ 508 542 $processor = new phpbmsTable($this->db, $tabledefid); 509 $processor->dateFormat = $ dateFormat;510 $processor->timeFormat = $t imeFormat;543 $processor->dateFormat = $this->options->dateFormat; 544 $processor->timeFormat = $this->options->timeFormat; 511 545 }//end if 512 546 513 547 } else { 514 548 $processor = new phpbmsTable($this->db, $tabledefid); 515 $processor->dateFormat = $ dateFormat;516 $processor->timeFormat = $t imeFormat;549 $processor->dateFormat = $this->options->dateFormat; 550 $processor->timeFormat = $this->options->timeFormat; 517 551 }//end if 518 552 519 553 $errorArray = $processor->verifyVariables($request["data"]); 520 554 521 if($ useUuid){555 if($this->options->useUuid){ 522 556 if(!isset($request["data"]["uuid"])) 523 557 $errorArray[] = "The `uuid` field must be set."; … … 532 566 else { 533 567 534 $processor->updateRecord($request["data"], NULL, (bool)$ useUuid);568 $processor->updateRecord($request["data"], NULL, (bool)$this->options->useUuid); 535 569 536 570 $this->_addToResponse("updated", "record updated in tabledef ".$tabledefid); … … 551 585 if(class_exists($maintable)){ 552 586 $processor = new $maintable($this->db, $tabledefid); 553 $processor->dateFormat = $ dateFormat;554 $processor->timeFormat = $t imeFormat;587 $processor->dateFormat = $this->options->dateFormat; 588 $processor->timeFormat = $this->options->timeFormat; 555 589 }else{ 556 590 $processor = new phpbmsTable($this->db, $tabledefid); 557 $processor->dateFormat = $ dateFormat;558 $processor->timeFormat = $t imeFormat;591 $processor->dateFormat = $this->options->dateFormat; 592 $processor->timeFormat = $this->options->timeFormat; 559 593 }//end if 560 594 561 595 } else { 562 596 $processor = new phpbmsTable($this->db, $tabledefid); 563 $processor->dateFormat = $ dateFormat;564 $processor->timeFormat = $t imeFormat;597 $processor->dateFormat = $this->options->dateFormat; 598 $processor->timeFormat = $this->options->timeFormat; 565 599 }//end if 566 600 567 if(!$ useUuid){568 $therecord = $processor->getRecord((int) $request["data"]["id"], $ useUuid);601 if(!$this->options->useUuid){ 602 $therecord = $processor->getRecord((int) $request["data"]["id"], $this->options->useUuid); 569 603 $thereturn = $therecord["id"]; 570 604 $thevalue = (int)$request["data"]["id"]; 571 605 }else{ 572 $therecord = $processor->getRecord(mysql_real_escape_string($request["data"]["uuid"]), $ useUuid);606 $therecord = $processor->getRecord(mysql_real_escape_string($request["data"]["uuid"]), $this->options->useUuid); 573 607 $thereturn = $therecord["uuid"]; 574 608 $thevalue = $request["data"]["uuid"]; … … 620 654 621 655 622 $result = $processor->delete_record($ useUuid);656 $result = $processor->delete_record($this->options->useUuid); 623 657 624 658 $this->_addToResponse($request["command"], $result); … … 733 767 734 768 $processor = new $className($this->db, $tabledefid, $request["data"]); 735 $processor->dateFormat = $ dateFormat;736 $processor->timeFormat = $t imeFormat;769 $processor->dateFormat = $this->options->dateFormat; 770 $processor->timeFormat = $this->options->timeFormat; 737 771 738 772 $methodName = $request["command"]; -
trunk/phpbms/modules/api/install/createtables.sql
r530 r645 1 CREATE TABLE `pushrecords` ( 2 `id` int(11) NOT NULL auto_increment, 3 `uuid` varchar(64) NOT NULL, 4 `originuuid` varchar(64) NOT NULL default '', 5 `destuuid` varchar(64) NOT NULL default '', 6 `apicommand` varchar(128) NOT NULL default 'insert', 7 `whereclause` varchar(256) NOT NULL default '', 8 `destscript` varchar(256) NOT NULL default '', 9 `name` varchar(128) NOT NULL default '', 10 `apiusername` varchar(128) NOT NULL default '', 11 `apipassword` varchar(128) NOT NULL default '', 12 `port` int(11) default NULL, 13 `server` varchar(255) NOT NULL default '', 14 `ssl` tinyint(4) NOT NULL default '0', 15 `httpformat` varchar(64) NOT NULL default 'POST', 16 `dataformat` varchar(64) NOT NULL default 'json', 17 `keepdestid` tinyint(1) NOT NULL default '0', 18 `useuuid` tinyint(1) NOT NULL default '0', 19 `dateformat` varchar(64) NOT NULL default 'SQL', 20 `timeformat` varchar(64) NOT NULL default '24 Hour', 21 `extraoptions` text, 22 `createdby` int(11) NOT NULL default '0', 23 `creationdate` datetime NOT NULL default '0000-00-00 00:00:00', 24 `modifiedby` int(11) default '0', 25 `modifieddate` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, 26 PRIMARY KEY (`id`), 27 UNIQUE KEY `uuid` (`uuid`) 28 ) ENGINE=InnoDB; -
trunk/phpbms/modules/api/install/install.php
r525 r645 18 18 $theModule->tables = array( 19 19 "modules", 20 "tablecolumns", 21 "tabledefs", 22 "tablefindoptions", 23 "tableoptions", 24 "tablesearchablefields" 20 25 ); 21 26 -
trunk/phpbms/modules/base/cron.php
r526 r645 16 16 $now = gmdate('Y-m-d H:i', strtotime('now')); 17 17 18 $querystat ment = "18 $querystatement = " 19 19 SELECT 20 20 id, 21 21 name, 22 22 crontab, 23 IF(`pushrecordid` != '', 'pushrecord', 'job') AS `type`, 23 24 job, 25 `pushrecordid`, 24 26 startdatetime, 25 27 enddatetime … … 31 33 AND (enddatetime > NOW() OR enddatetime IS NULL)"; 32 34 33 $queryresult=$db->query($querystat ment);35 $queryresult=$db->query($querystatement); 34 36 35 37 while($schedule_record=$db->fetchArray($queryresult)){ … … 51 53 if(is_array($validTimes) && in_array($now, $validTimes)){ 52 54 53 $success = @ include($schedule_record["job"]); 55 switch($schedule_record["type"]){ 56 57 case "job": 58 $success = @ include($schedule_record["job"]); 59 break; 60 61 case "pushrecord": 62 include_once("modules/api/include/push.php"); 63 $push = new push($db, $schedule_record["pushrecordid"]); 64 $success = $push->process(); 65 break; 66 67 }//end switch 54 68 55 69 if($success){ -
trunk/phpbms/modules/base/include/scheduler.php
r621 r645 56 56 $therecord["enddate"]=""; 57 57 $therecord["endtime"]=""; 58 59 $therecord["scripttype"] = "job"; 58 60 59 61 return $therecord; … … 65 67 $therecord = parent::getRecord($id, $useUuid); 66 68 69 if($therecord["job"]) 70 $therecord["scripttype"] = "job"; 71 else 72 $therecord["scripttype"] = "pushrecord"; 73 74 75 67 76 $datearray=explode(" ",$therecord["startdatetime"]); 68 77 $therecord["startdate"]=$datearray[0]; … … 88 97 89 98 function verifyVariables($variables){ 90 91 //must have the file that has the job that will 92 //be run. 99 100 $validJob = true; 93 101 if(isset($variables["job"])){ 94 if( !$variables["job"] === "" || $variables["job"] === NULL)95 $ this->verifyErrors[] = "The `job` field must not be blank.";102 if($variables["job"] === "" || $variables["job"] === NULL) 103 $validJob = false; 96 104 }else 97 $this->verifyErrors[] = "The `job` field must be set."; 105 $validJob = false; 106 107 $validPush = true; 108 if(isset($variables["pushrecordid"])){ 109 if($variables["pushrecordid"] === "" || $variables["pushrecordid"] === NULL) 110 $validPush = false; 111 }else 112 $validPush = false; 113 114 if(!$validPush && !$validJob) 115 $this->verifyErrors[] = "The `job` or the `pushrecordid` must be set and not blank."; 98 116 99 117 //checks to see if crontab is in the (somewhat) right format … … 103 121 $this->verifyErrors[] = "The `crontab` field is not of the proper form. There must be four pairs of '::' in the field's value."; 104 122 }//end if 105 123 106 124 return parent::verifyVariables($variables); 107 125 … … 133 151 $variables["enddatetime"] = NULL; 134 152 135 153 switch($variables["scripttype"]){ 154 155 case "job": 156 $variables["pushrecordid"] = ""; 157 break; 158 159 case "pushrecord": 160 $variables["job"] = ""; 161 break; 162 163 }//end switch 164 136 165 return $variables; 137 } 166 167 }//end function 138 168 139 169 }//end class -
trunk/phpbms/modules/base/include/tabledefs.php
r641 r645 46 46 $therecord = parent::getDefaults(); 47 47 48 $therecord["moduleid"]= 1;48 $therecord["moduleid"]="mod:29873ee8-c12a-e3f6-9010-4cd24174ffd7"; 49 49 $therecord["deletebutton"]="delete"; 50 50 $therecord["type"]="table"; 51 $therecord["searchroleid"] =0;52 $therecord["importroleid"] =-100;53 $therecord["advsearchroleid"] =-100;54 $therecord["viewsqlroleid"] =-100;51 $therecord["searchroleid"] = ""; 52 $therecord["importroleid"] = "Admin"; 53 $therecord["advsearchroleid"] = "Admin"; 54 $therecord["viewsqlroleid"] = "Admin"; 55 55 56 56 return $therecord; … … 269 269 //and last findfields 270 270 $querystatement = "INSERT INTO `tablesearchablefields` (`tabledefid`, `field`, `name`, `displayorder`, `type`) 271 VALUES ('".$variables["uuid"]."','".$variables["maintable"].". uuid','uuid',1,'field');";271 VALUES ('".$variables["uuid"]."','".$variables["maintable"].".id','id',1,'field');"; 272 272 $this->db->query($querystatement); 273 273 -
trunk/phpbms/modules/base/include/tabledefs_options_include.php
r551 r645 44 44 var $tabledefuuid; 45 45 var $tablename; 46 var $hasRelatedPushRecord = false; 46 47 47 48 function tableOptions($db, $tabledefid){ … … 64 65 65 66 $this->tabledefuuid = $therecord["uuid"]; 67 68 /** 69 * Check for push records 70 */ 71 //if(isset($phpbms)){ 72 // if(moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)){ 73 // $querystatement = " 74 // SELECT 75 // `id` 76 // FROM 77 // `pushrecords` 78 // WHERE 79 // `originuuid` = '".$this->tabledefuuid."' 80 // "; 81 // 82 // $queryresult = $this->db->query($querystatement); 83 // if($this->db-numRows($queryresult)) 84 // $this->hasRelatedPushRecord = true; 85 // 86 // } 87 //} 88 66 89 $this->tablename = formatVariable($therecord["displayname"]); 67 90 … … 71 94 function getDefaults(){ 72 95 73 returnarray(96 $thereturn = array( 74 97 "id" => NULL, 75 98 "name" => "", … … 78 101 "othercommand" => 0, 79 102 "roleid" => 0, 80 "displayorder" => 0 103 "displayorder" => 0, 104 "pushrecordid" => "", 105 "type" => 0, 81 106 ); 107 108 return $thereturn; 82 109 83 110 }//end function getDefaults … … 90 117 tableoptions.id, 91 118 tableoptions.name, 119 tableoptions.name AS `displayname`, 120 IF(`tableoptions`.`othercommand`='0','1',IF(`tableoptions`.`name` LIKE '%:%','3','2')) AS `commandtype`, 92 121 tableoptions.option, 93 122 tableoptions.othercommand, 123 tableoptions.othercommand AS `type`, 94 124 tableoptions.displayorder, 95 125 tableoptions.roleid, … … 109 139 $querystatement .= " 110 140 ORDER BY 111 tableoptions.othercommand,141 `commandtype`, 112 142 tableoptions.displayorder, 113 143 tableoptions.name"; 114 144 115 return $this->db->query($querystatement); 145 $queryresult = $this->db->query($querystatement); 146 147 $thereturn = array(); 148 while($therecord = $this->db->fetchArray($queryresult)){ 149 150 $therecord["pushrecordid"] = ""; 151 152 /** 153 * Here, we check to see if the 'name' field is a pushrecord 154 * uuid. If so, we need to set the pushrecordid. 155 */ 156 if($therecord["commandtype"] == 3){ 157 158 $therecord["pushrecordid"] = $therecord["name"]; 159 160 /** 161 * Need name of the push record 162 */ 163 $pushquery = " 164 SELECT 165 `name` 166 FROM 167 `pushrecords` 168 WHERE 169 `uuid` = '".$therecord["name"]."' 170 "; 171 172 $pushresult = $this->db->query($pushquery); 173 174 if($this->db->numRows($pushresult)){ 175 $pushrecord = $this->db->fetchArray($pushresult); 176 $therecord["displayname"] = $pushrecord["name"]; 177 }//end if 178 179 $therecord["type"] = 2; 180 181 }//end if 182 183 $thereturn[] = $therecord; 184 185 }//end while 186 187 return $thereturn; 188 //return $this->db->query($querystatement); 116 189 117 190 }//end method 118 191 119 192 120 function showRecords($queryresult){ 193 /** 194 * function showRecords 195 * @param array $recordArray 196 */ 197 198 function showRecords($recordArray){ 121 199 122 200 global $phpbms; … … 143 221 <tbody> 144 222 <?php 145 if( $this->db->numRows($queryresult)){223 if(count($recordArray)){ 146 224 147 225 $row = 1; 148 226 149 $other = 3;150 151 while($therecord = $this->db->fetchArray($queryresult)){227 $other = 4; 228 229 foreach($recordArray as $therecord){ 152 230 153 231 $row = ($row == 1) ? 2 : 1; 154 232 155 if($therecord["othercommand"] !== $other){ 156 157 ?><tr class="queryGroup"><td colspan="7"><?php echo ($therecord["othercommand"] == 1)? "Additional Commands" : "Integrated Features";?></td></tr><?php 158 159 $other = $therecord["othercommand"]; 233 if($therecord["commandtype"] !== $other){ 234 235 switch($therecord["commandtype"]){ 236 237 case 1: 238 $title = "Integrated Features"; 239 break; 240 241 case 2: 242 $title = "Additional Commands"; 243 break; 244 245 case 3: 246 $title = "Api Commands"; 247 break; 248 249 }//end if 250 251 ?><tr class="queryGroup"><td colspan="7"><?php echo $title;?></td></tr><?php 252 253 $other = $therecord["commandtype"]; 160 254 161 255 }//end if ?> … … 200 294 201 295 if($therecord["othercommand"]) 202 echo formatVariable($therecord[" name"]);296 echo formatVariable($therecord["displayname"]); 203 297 else 204 298 echo " "; … … 249 343 $variables["needselect"] = 0; 250 344 251 if($variables["type"]){ 252 253 $name = $variables["acName"]; 254 $option = $variables["acOption"]; 255 256 } else { 257 258 $name = $variables["ifName"]; 259 $option = $variables["ifOption"]; 260 261 } //end if 345 switch($variables["type"]){ 346 347 case 0: 348 $name = $variables["ifName"]; 349 $option = $variables["ifOption"]; 350 break; 351 352 case 1: 353 $name = $variables["acName"]; 354 $option = $variables["acOption"]; 355 break; 356 357 case 2: 358 $name = $variables["productid"]; 359 $option = $variables["acOption"]; 360 break; 361 362 }//end switch 262 363 263 364 $insertstatement = " … … 296 397 $variables["needselect"] = 0; 297 398 399 if($variables["type"]) 400 $variables["othercommand"] = 1; 401 else 402 $variables["othercommand"] = 0; 403 298 404 $updatestatement = " 299 405 UPDATE … … 302 408 roleid = '".$variables["roleid"]."', 303 409 displayorder = ".((int) $variables["displayorder"]).", 304 othercommand = ".((int) $variables[" type"]).",410 othercommand = ".((int) $variables["othercommand"]).", 305 411 needselect = ".((int) $variables["needselect"]).","; 306 412 307 if(!$variables["type"]) 308 $updatestatement .= " 309 name = '".$variables["ifName"]."', 310 `option` = '".$variables["ifOption"]."' 311 "; 312 else 313 $updatestatement .= " 314 name = '".$variables["acName"]."', 315 `option` = '".$variables["acOption"]."' 316 "; 413 switch($variables["type"]){ 414 415 case 0: 416 $updatestatement .= " 417 name = '".$variables["ifName"]."', 418 `option` = '".$variables["ifOption"]."' 419 "; 420 break; 421 422 case 1: 423 $updatestatement .= " 424 name = '".$variables["acName"]."', 425 `option` = '".$variables["acOption"]."' 426 "; 427 break; 428 429 case 2: 430 $updatestatement .= " 431 `name` = '".$variables["pushrecordid"]."', 432 `option` = '".$variables["acOption"]."' 433 "; 434 break; 435 436 }//end switch 317 437 318 438 $updatestatement .= " … … 348 468 349 469 case "edit": 350 $ queryresult= $this->get($variables["id"]);351 $therecord = $th is->db->fetchArray($queryresult);470 $therecord = $this->get($variables["id"]); 471 $therecord = $therecord[0]; 352 472 break; 353 473 -
trunk/phpbms/modules/base/javascript/tableoptions.js
r318 r645 1 1 tableOptions = { 2 2 3 3 switchType: function(e){ 4 4 5 5 var type = getObjectFromID("type"); 6 6 var ifDiv = getObjectFromID("ifDiv"); 7 7 var acDiv = getObjectFromID("acDiv"); 8 9 if(type.value == 1){ 10 11 ifDiv.style.display = "none"; 12 acDiv.style.display = "block"; 13 14 } else { 15 16 ifDiv.style.display = "block"; 17 acDiv.style.display = "none"; 18 19 }//end if 20 8 var acNote = getObjectFromID("acNote"); 9 var apiNote = getObjectFromID("apiNote"); 10 11 switch(type.value){ 12 13 case "0": 14 ifDiv.style.display = "block"; 15 acDiv.style.display = "none"; 16 apiNote.style.display = "none"; 17 acNote.style.display = "none"; 18 break; 19 20 case "1": 21 ifDiv.style.display = "none"; 22 acDiv.style.display = "block"; 23 apiNote.style.display = "none"; 24 acNote.style.display = "block"; 25 break; 26 27 case "2": 28 ifDiv.style.display = "none"; 29 acDiv.style.display = "block"; 30 apiNote.style.display = "block"; 31 acNote.style.display = "none"; 32 break; 33 } 34 21 35 },//end method 22 23 36 37 24 38 edit: function(e){ 25 39 26 40 tableOptions._tableButtonClick(e, "edit") 27 41 28 42 }, //end method 29 30 43 44 31 45 del: function(e){ 32 46 33 47 tableOptions._tableButtonClick(e, "delete") 34 48 35 49 },//end method 36 37 50 51 38 52 _tableButtonClick: function(e, thecommand){ 39 53 40 54 var id = getObjectFromID("id"); 41 55 var command = getObjectFromID("command"); 42 56 43 57 var button = e.src(); 44 58 45 59 var theid = button.id.substr(3); 46 60 47 61 id.value = theid; 48 62 command.value = thecommand; 49 63 50 tableOptions.submitForm(e); 64 tableOptions.submitForm(e); 51 65 52 66 }, //end method 53 54 67 68 55 69 submitForm: function(e){ 56 70 57 71 var command = getObjectFromID("command"); 58 72 var theform = getObjectFromID("record") 59 73 60 74 if(command.value == "add" || command.value == "update"){ 61 75 … … 67 81 68 82 }//end if 69 83 70 84 theform.submit(); 71 85 72 86 }, //end method 73 74 87 88 75 89 cancel: function(e){ 76 90 77 91 var command = getObjectFromID("command"); 78 92 79 93 command.value = "cancel"; 80 94 81 tableOptions.submitForm(e); 95 tableOptions.submitForm(e); 82 96 83 97 }//end method 84 98 85 99 }//end class 86 100 … … 88 102 /* ------------------------------------------------------- */ 89 103 connect(window,"onload",function() { 90 104 91 105 var type = getObjectFromID("type") 92 connect(type, "onchange", tableOptions.switchType); 93 106 connect(type, "onchange", tableOptions.switchType); 107 94 108 var theForm = getObjectFromID("record"); 95 109 connect(type, "onsubmit", function(e){e.stop();}); 96 110 97 111 var delButtons = getElementsByClassName("buttonDelete"); 98 112 for(var i=0; i < delButtons.length; i++) 99 connect(delButtons[i], "onclick", tableOptions.del); 100 113 connect(delButtons[i], "onclick", tableOptions.del); 114 101 115 var editButtons = getElementsByClassName("buttonEdit"); 102 116 for(var i=0; i < editButtons.length; i++) 103 connect(editButtons[i], "onclick", tableOptions.edit); 104 117 connect(editButtons[i], "onclick", tableOptions.edit); 118 105 119 var cancelButton = getObjectFromID("cancel"); 106 120 if(cancelButton) 107 121 connect(cancelButton, "onclick", tableOptions.cancel); 108 122 109 123 var saveButton = getObjectFromID("save"); 110 connect(saveButton, "onclick", tableOptions.submitForm); 111 124 connect(saveButton, "onclick", tableOptions.submitForm); 125 112 126 tableOptions.switchType(); 113 127 114 128 });//end connect -
trunk/phpbms/modules/base/scheduler_addedit.php
r592 r645 54 54 55 55 $phpbms->cssIncludes[] = "pages/scheduler.css"; 56 $phpbms->jsIncludes[] = "modules/base/javascript/scheduler.js"; 56 57 57 58 //Form Elements 58 59 //============================================================== 59 60 $theform = new phpbmsForm(); 61 $theform->id = $theform->name; 60 62 61 63 $theinput = new inputCheckbox("inactive",$therecord["inactive"]); … … 66 68 $theform->addField($theinput); 67 69 68 $theinput = new inputField("job",$therecord["job"],"script",true,NULL,32,128,false); 70 if(moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)){ 71 72 $list = array( 73 "file" => "job", 74 "push record"=>"pushrecord" 75 ); 76 $theinput = new inputBasicList("scripttype", $therecord["scripttype"], $list, "script type"); 77 $theform->addField($theinput); 78 79 $theinput = new inputSmartSearch($db, "pushrecordid", "Pick Push Record For Cron", $therecord["pushrecordid"]); 80 $theform->addField($theinput); 81 82 }//end if 83 84 $theinput = new inputField("job",$therecord["job"],"script",false,NULL,32,128,false); 69 85 $theform->addField($theinput); 70 86 71 87 $theinput = new inputDatePicker("startdate",$therecord["startdate"], "start date" ,true, 11, 15, false); 72 88 $theform->addField($theinput); 73 89 74 90 $theinput = new inputTimePicker("starttime",$therecord["starttime"], "start time" ,true,11, 15, false); 75 //$theinput->setAttribute("onchange","checkEndDate();");76 91 $theform->addField($theinput); 77 92 … … 115 130 <p><?php $theform->showField("name");?></p> 116 131 117 <p> 118 <label for="job">script</label> <span class="notes">(path relative to <?php echo $currentpath?>)</span><br /> 119 <?php $theform->showField("job");?> 132 <?php if(moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)){ ?> 133 <p><?php $theform->showField("scripttype"); ?></p> 134 <p id="pushrecordidp"> 135 <?php $theform->showField("pushrecordid"); ?> 136 </p> 137 <?php }//end if ?> 138 <p id="jobp"> 139 <label for="job">script</label> <span class="notes">(path relative to <?php echo $currentpath?>)</span><br /> 140 <?php $theform->showField("job");?> 120 141 </p> 121 142 <p> -
trunk/phpbms/modules/base/smartsearches_addedit.php
r643 r645 40 40 include("include/fields.php"); 41 41 include("include/tables.php"); 42 42 43 43 44 $thetable = new phpbmstable($db,"tbld:29925e0a-c825-0067-8882-db4b57866a96"); -
trunk/phpbms/modules/base/tabledefs_options.php
r551 r645 70 70 "Additional Commands" => 1, 71 71 ); 72 $theinput = new inputBasicList("type", $therecord["othercommand"], $temparray); 73 $theform->addField($theinput); 74 75 $temparray =array( 72 73 74 if(moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)){ 75 $temparray["Api Commands"] = 2; 76 77 $theinput = new inputDataTableList($db, "pushrecordid", $therecord["pushrecordid"], "pushrecords", "pushrecords.uuid", 78 "pushrecords.name", "pushrecords.originuuid = '".$options->tabledefuuid."'", 79 "pushrecords.name ASC", true, "Push Record Commands"); 80 $theform->addField($theinput); 81 } 82 83 $theinput = new inputBasicList("type", $therecord["type"], $temparray); 84 $theform->addField($theinput); 85 86 $temparray = array( 76 87 "new" => "new", 77 88 "edit" => "edit", … … 157 168 <div id="acDiv"> 158 169 159 <p class="notes"> 160 Additional command allows you to add items to the 161 other commands drop down on the search screen. 162 The PHP method name should refrence a function 163 in the tables extended searchFunctions class 164 in the [tablename].php located in the modules 165 include folder. 166 </p> 170 <div id="acNote"> 171 <p class="notes"> 172 Additional command allows you to add items to the 173 other commands drop down on the search screen. 174 The PHP method name should refrence a function 175 in the tables extended searchFunctions class 176 in the [tablename].php located in the modules 177 include folder. 178 </p> 179 <p><?php $theform->showField("acName") ?></p> 180 </div> 181 <?php if(moduleExists("mod:b2d42220-443b-fe74-dbdb-ed2c0968c38c", $phpbms->modules)){ ?> 182 <div id="apiNote"> 183 <p class="notes"> 184 API stuff. 185 </p> 186 <p><?php $theform->showfield("pushrecordid"); ?></p> 187 </div> 188 <?php }//end if ?> 167 189 168 190 <p><?php $theform->showField("acOption") ?></p> 169 170 <p><?php $theform->showField("acName") ?></p>171 191 172 192 <p><?php $theform->showField("needselect") ?></p> -
trunk/phpbms/modules/bms/include/clients.php
r638 r645 228 228 if( $variables["otherphone"] !== NULL && $variables["otherphone"] !== "" && !validatePhone($variables["otherphone"])) 229 229 $this->verifyErrors[] = "The `otherphone` field must have a valid phone number (as set in configuration) or must be left blank."; 230 230 */ 231 231 //check bool on has credit 232 232 if(isset($variables["hascredit"])) 233 233 if($variables["hascredit"] && $variables["hascredit"] != 1) 234 $this->verifyErrors[] = "The `hascredit` field must be a boolean (equivalent to 0 or exactly 1)."; */234 $this->verifyErrors[] = "The `hascredit` field must be a boolean (equivalent to 0 or exactly 1)."; 235 235 236 236 -
trunk/phpbms/modules/bms/javascript/invoice.js
r643 r645 1326 1326 function calculateTotal(){ 1327 1327 1328 var thetotalBD =getObjectFromID("totalBD");1329 var subtotal =getObjectFromID("totaltni");1330 var thediscount =getObjectFromID("discountamount");1331 var shipping =getObjectFromID("shipping");1332 var taxpercentage =getObjectFromID("taxpercentage");1333 var tax =getObjectFromID("tax");1334 var totalti =getObjectFromID("totalti");1335 var totaltaxable =getObjectFromID("totaltaxable");1336 var discountFromID =getObjectFromID("discount");1328 var thetotalBD = getObjectFromID("totalBD"); 1329 var subtotal = getObjectFromID("totaltni"); 1330 var thediscount = getObjectFromID("discountamount"); 1331 var shipping = getObjectFromID("shipping"); 1332 var taxpercentage = getObjectFromID("taxpercentage"); 1333 var tax = getObjectFromID("tax"); 1334 var totalti = getObjectFromID("totalti"); 1335 var totaltaxable = getObjectFromID("totaltaxable"); 1336 var discountFromID = getObjectFromID("discount"); 1337 1337 1338 1338 //calculate and reformat discount … … 1343 1343 // compute discount from discount id 1344 1344 if(discountFromID.value.indexOf("%")!=-1){ 1345 numDiscount=parseFloat(thetotalBD.value)*parseFloat(discountFromID.value.substring(0,discountFromID.value.length-1))/100 1345 numDiscount=parseFloat(thetotalBD.value)*parseFloat(discountFromID.value.substring(0,discountFromID.value.length-1))/100; 1346 1346 } else { 1347 1347 numDiscount=parseFloat(discountFromID.value); … … 1349 1349 } 1350 1350 1351 thediscount.value = numberToCurrency(numDiscount);1351 thediscount.value = numberToCurrency(numDiscount); 1352 1352 1353 1353 //calculate totaltaxable … … 1362 1362 1363 1363 //next calculate and reformat shipping 1364 var numshipping =currencyToNumber(shipping.value);1365 shippingValue =numberToCurrency(numshipping);1366 shipping.value =shippingValue;1364 var numshipping = currencyToNumber(shipping.value); 1365 shippingValue = numberToCurrency(numshipping); 1366 shipping.value = shippingValue; 1367 1367 1368 1368 //next calculate and reformat tax … … 1386 1386 1387 1387 //last calculate and format the grand total 1388 var thetotal =numsubtotal+numshipping+numtax;1388 var thetotal = roundForCurrency(numsubtotal + numshipping + numtax); 1389 1389 thetotal=numberToCurrency(thetotal); 1390 1390 totalti.value=thetotal;