[Vtigercrm-developers] vtlib Custom Module Numbering Field
Alan Lord
alanslists at gmail.com
Thu Apr 25 08:11:13 UTC 2013
Hi all,
I've created a few vtlib modules for a client and am adding a
auto-numbered field, e.g.
// Payment No.
$field_paymentno = Vtiger_Field::getInstance('paymentno', $module);
if ($field_paymentno != false) {
$field_paymentno->delete();
}
$field_paymentno = new Vtiger_Field();
$field_paymentno->name = 'paymentno';
$field_paymentno->column = 'paymentno';
$field_paymentno->label = 'LBL LSPAYMENT NUM';
$field_paymentno->columntype = 'VARCHAR(100)';
$field_paymentno->uitype = 4;
$field_paymentno->presence = 0; // Why can't I set this?
$field_paymentno->typeofdata = 'V~O';
$block_main->addField($field_paymentno);
// Set the Auto Sequence No.
$entity_tmp = new CRMEntity();
$entity_tmp->setModuleSeqNumber('configure', $module->name, 'PAYM', 1);
I have tried with and without a field as mandatory for import in my
module class:
// Required Information for enabling Import feature
var $required_fields = Array();
or
var $required_fields = Array('lspaytype'=>1);
I have enabled tools and the correct entries are in the profile2utility
table.
$module->enableTools(Array('Import', 'Export'));
But when I try and do an import I just get a horrible javascript error
See below).
Firebug isn't showing me anything interesting either...
Anyone got any smart ideas?
Cheers
Al
> Please map the following mandatory fields : "function (iterator) {
> var index = 0;
> try {
> this._each(function(value) {
> try {
> iterator(value, index++);
> } catch (e) {
> if (e != $continue) throw e;
> }
> });
> } catch (e) {
> if (e != $break) throw e;
> }
> }","function (iterator) {
> var result = true;
> this.each(function(value, index) {
> result = result && !!(iterator || Prototype.K)(value, index);
> if (!result) throw $break;
> });
> return result;
> }","function (iterator) {
> var result = true;
> this.each(function(value, index) {
> if (result = !!(iterator || Prototype.K)(value, index))
> throw $break;
> });
> return result;
> }","function (iterator) {
> var results = [];
> this.each(function(value, index) {
> results.push(iterator(value, index));
> });
> return results;
> }","function (iterator) {
> var result;
> this.each(function(value, index) {
> if (iterator(value, index)) {
> result = value;
> throw $break;
> }
> });
> return result;
> }","function (iterator) {
> var results = [];
> this.each(function(value, index) {
> if (iterator(value, index))
> results.push(value);
> });
> return results;
> }","function (pattern, iterator) {
> var results = [];
> this.each(function(value, index) {
> var stringValue = value.toString();
> if (stringValue.match(pattern))
> results.push((iterator || Prototype.K)(value, index));
> })
> return results;
> }","function (object) {
> var found = false;
> this.each(function(value) {
> if (value == object) {
> found = true;
> throw $break;
> }
> });
> return found;
> }","function (memo, iterator) {
> this.each(function(value, index) {
> memo = iterator(memo, value, index);
> });
> return memo;
> }","function (method) {
> var args = $A(arguments).slice(1);
> return this.collect(function(value) {
> return value[method].apply(value, args);
> });
> }","function (iterator) {
> var result;
> this.each(function(value, index) {
> value = (iterator || Prototype.K)(value, index);
> if (result == undefined || value >= result)
> result = value;
> });
> return result;
> }","function (iterator) {
> var result;
> this.each(function(value, index) {
> value = (iterator || Prototype.K)(value, index);
> if (result == undefined || value < result)
> result = value;
> });
> return result;
> }","function (iterator) {
> var trues = [], falses = [];
> this.each(function(value, index) {
> ((iterator || Prototype.K)(value, index) ?
> trues : falses).push(value);
> });
> return [trues, falses];
> }","function (property) {
> var results = [];
> this.each(function(value, index) {
> results.push(value[property]);
> });
> return results;
> }","function (iterator) {
> var results = [];
> this.each(function(value, index) {
> if (!iterator(value, index))
> results.push(value);
> });
> return results;
> }","function (iterator) {
> return this.collect(function(value, index) {
> return {value: value, criteria: iterator(value, index)};
> }).sort(function(left, right) {
> var a = left.criteria, b = right.criteria;
> return a < b ? -1 : a > b ? 1 : 0;
> }).pluck('value');
> }","function () {
> return this.collect(Prototype.K);
> }","function () {
> var iterator = Prototype.K, args = $A(arguments);
> if (typeof args.last() == 'function')
> iterator = args.pop();
>
> var collections = [this].concat(args).map($A);
> return this.map(function(value, index) {
> return iterator(collections.pluck(index));
> });
> }","function () {
> return '[' + this.map(Object.inspect).join(', ') + ']';
> }","function (iterator) {
> var result;
> this.each(function(value, index) {
> if (iterator(value, index)) {
> result = value;
> throw $break;
> }
> });
> return result;
> }","function (iterator) {
> var results = [];
> this.each(function(value, index) {
> if (iterator(value, index))
> results.push(value);
> });
> return results;
> }","function (object) {
> var found = false;
> this.each(function(value) {
> if (value == object) {
> found = true;
> throw $break;
> }
> });
> return found;
> }","function () {
> return this.collect(Prototype.K);
> }","function reverse() {
> [native code]
> }","function (iterator) {
> for (var i = 0; i < this.length; i++)
> iterator(this[i]);
> }","function () {
> this.length = 0;
> return this;
> }","function () {
> return this[0];
> }","function () {
> return this[this.length - 1];
> }","function () {
> return this.select(function(value) {
> return value != undefined || value != null;
> });
> }","function () {
> return this.inject([], function(array, value) {
> return array.concat(value && value.constructor == Array ?
> value.flatten() : [value]);
> });
> }","function () {
> var values = $A(arguments);
> return this.select(function(value) {
> return !values.include(value);
> });
> }"
More information about the vtigercrm-developers
mailing list