*
* TODO generalize
* TODO translate field names (modelconfig?)
+ * TODO allow non scalar values
*/
protected function _getNotificationUpdates($lead, $oldLead)
{
foreach ($lead->diff($oldLead, array('seq', 'notes', 'tags', 'relations', 'last_modified_time', 'last_modified_by'))->diff
as $key => $value)
{
- $result[] = array(
- 'modified_attribute' => $key,
- 'old_value' => $value,
- 'new_value' => $lead->{$key}
- );
+ // only allow scalars atm
+ if (! is_array($value) && ! is_array($lead->{$key})) {
+ $result[] = array(
+ 'modified_attribute' => $key,
+ 'old_value' => $value,
+ 'new_value' => $lead->{$key}
+ );
+ }
}
return $result;
*
* don't use the constructor. use the singleton
*/
- private function __construct() {
+ private function __construct()
+ {
$this->_applicationName = 'Sales';
$this->_backend = new Sales_Backend_Contract();
$this->_modelName = 'Sales_Model_Contract';
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
*
* don't use the constructor. use the singleton
*/
- private function __construct() {
+ private function __construct()
+ {
$this->_applicationName = 'Sales';
$this->_backend = new Sales_Backend_Customer();
$this->_modelName = 'Sales_Model_Customer';
$this->_doContainerACLChecks = FALSE;
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
*
* don't use the constructor. use the singleton
*/
- private function __construct() {
+ private function __construct()
+ {
$this->_applicationName = 'Sales';
$this->_backend = new Sales_Backend_Invoice();
$this->_modelName = 'Sales_Model_Invoice';
$this->_doContainerACLChecks = FALSE;
$this->_cachedProducts = new Tinebase_Record_RecordSet('Sales_Model_Product');
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
$this->_applicationName = 'Sales';
$this->_backend = new Sales_Backend_Offer();
$this->_modelName = 'Sales_Model_Offer';
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
*
* don't use the constructor. use the singleton
*/
- private function __construct() {
+ private function __construct()
+ {
$this->_applicationName = 'Sales';
$this->_backend = new Sales_Backend_OrderConfirmation();
$this->_modelName = 'Sales_Model_OrderConfirmation';
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
*
* don't use the constructor. use the singleton
*/
- private function __construct() {
+ private function __construct()
+ {
$this->_backend = new Sales_Backend_Product();
$this->_numberPrefix = Sales_Config::getInstance()->get(Sales_Config::PRODUCT_NUMBER_PREFIX);
$this->_numberZerofill = Sales_Config::getInstance()->get(Sales_Config::PRODUCT_NUMBER_ZEROFILL);
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
*
* don't use the constructor. use the singleton
*/
- private function __construct() {
+ private function __construct()
+ {
$this->_backend = new Sales_Backend_PurchaseInvoice();
$this->_duplicateCheckFields = array(
array('number'),
array('date', 'price_total'),
);
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
*
* don't use the constructor. use the singleton
*/
- private function __construct() {
+ private function __construct()
+ {
$this->_backend = new Sales_Backend_Supplier();
+ // TODO this should be done automatically if model has customfields (hasCustomFields)
+ $this->_resolveCustomFields = true;
}
/**
{
$tableName = SQL_TABLE_PREFIX . 'relations';
- $select = $this->_db->select()->from($tableName)->columns('rel_id')
- ->where($this->_db->quoteIdentifier('own_model') . ' LIKE ?', $applicationName . '_%');
+ $select = $this->_db->select()->from($tableName, array('rel_id'))
+ ->where($this->_db->quoteIdentifier('own_model') . ' LIKE ?', $applicationName . '_%')
+ ->limit(10000);
- $relation_ids = $this->_db->fetchCol($select);
+ do {
+ $relation_ids = $this->_db->fetchCol($select);
- if (is_array($relation_ids) && count($relation_ids) > 0) {
- $this->_db->delete($tableName, $this->_db->quoteInto($this->_db->quoteIdentifier('rel_id') . ' IN (?)', $relation_ids));
- }
+ if (is_array($relation_ids) && count($relation_ids) > 0) {
+ $this->_db->delete($tableName, $this->_db->quoteInto($this->_db->quoteIdentifier('rel_id') . ' IN (?)', $relation_ids));
+ } else {
+ break;
+ }
+ } while(true);
}
}