}
}
+ /**
+ * Resets the API object to an initial state. This will NOT clear the primary (REQ_AUTO)
+ * field.
+ */
+ public function reset()
+ {
+ foreach ($this->fields as $field => $settings)
+ {
+ if ($settings[F_REQ] == REQ_AUTO)
+ {
+ $savename = $field;
+ $savevalue = $this->fetchValue($field);
+ $savevalue = ($savevalue ? $savevalue : $this->insertid);
+ break;
+ }
+ }
+
+ $this->setfields = array();
+ $this->values = array();
+ $this->condition = '';
+ $this->insertid = 0;
+ $this->exception = null;
+
+ $this->set($savename, $savevalue);
+ }
+
/**
* Sets a value, sanitizes it, and validates it
*
}
}
+ /**
+ * Determines the value of a field from Api->record[], Api->values[] (in that order)
+ *
+ * @param string The field ID to determine for
+ *
+ * @return mixed
+ */
+ public function fetchValue($field)
+ {
+ if ($this->record[$field])
+ {
+ return $this->record[$field];
+ }
+ else if ($this->values[$field])
+ {
+ return $this->values[$field];
+ }
+
+ return null;
+ }
+
/**
* Verify field: not a zero value
*/
3.1.3
===================
- Fixed: BSPrinterRootForm's marked as ::setUpload() would not have the right enctype set
+- New: BSApi::reset() will reset the object back to an initial state with only the key field still set
+- New: BSApi::fetchValue() will return the value of a given field from either ->record[] or ->values[]
3.1.2
===================