"Module already present - choose a different name." vtiger 6.4 - vtiger

I followed all the steps mentioned on create custom module in vtiger 6 to create custom module but I am getting the error Module already present - choose a different name
Please advice.

As your are using vtiger 6.4 , there are lot of difference between vTiger 6 and vtiger6.4.
Try with the below script as I am using same for new module creation. Use new module name. And change the UI Types and field labels as per your requirement.
<?php
$Vtiger_Utils_Log = true;
include_once('vtlib/Vtiger/Menu.php');
include_once('vtlib/Vtiger/Module.php');
$module = new Vtiger_Module();
$module->name = 'Your_MODULE_NAME';
$module->parent = 'Tools';
$module->save();
$module->initTables();
$module->initWebservice();
$block = new Vtiger_Block();
$block->label = 'LBL_INFORMATION_DETAIL';
$module->addBlock($block); //to create a new block
$field1 = new Vtiger_Field();
$field1->name = 'browse';
$field1->table=$module->basetable;
$field1->label= 'Upload Csv';
$field1->column = 'browse';
$field1->columntype = 'VARCHAR(255)';
$field1->uitype= 28;
$field1->typeofdata = 'V~O';
$block->addField($field1);
$field2 = new Vtiger_Field();
$field2->name = 'fieldid';
$field2->table=$module->basetable;
$field2->label= 'Record ID';
$field2->uitype= 4;
$field2->column = 'fieldid';
$field2->columntype = 'VARCHAR(255)';
$field2->typeofdata = 'V~M';
$block->addField($field2);
$module->setEntityIdentifier($field2);
$field3 = new Vtiger_Field();
$field3->name = 'age';
$field3->table=$module->basetable;
$field3->label= 'Age';
$field3->uitype= 1;
$field3->column = 'age';
$field3->columntype = 'VARCHAR(100)';
$field3->typeofdata = 'V~O';
$block->addField($field3);
$field4 = new Vtiger_Field();
$field4->name = 'statusrecord';
$field4->table=$module->basetable;
$field4->label= 'Status';
$field4->uitype= 15;
$field4->column = 'statusrecord';
$field4->columntype = 'VARCHAR(255)';
$field4->setPicklistValues( Array('new','closed','closedwithfailure','inprogress'));
$field4->typeofdata = 'V~M';
$block->addField($field4);
// Recommended common fields every Entity module should have (linked to core table)
$field5 = new Vtiger_Field();
$field5->name = 'assigned_user_id';
$field5->label = 'Assigned To';
$field5->table = 'Vtiger_crmentity';
$field5->column = 'smownerid';
$field5->uitype = 53;
$field5->typeofdata = 'V~M';
$block->addField($field5);
$field6 = new Vtiger_Field();
$field6->name = 'CreatedTime';
$field6->label= 'Created Time';
$field6->table = 'Vtiger_crmentity';
$field6->column = 'createdtime';
$field6->uitype = 70;
$field6->typeofdata = 'T~O';
$field6->displaytype= 2;
$block->addField($field6);
$field7 = new Vtiger_Field();
$field7->name = 'ModifiedTime';
$field7->label= 'Modified Time';
$field7->table = 'Vtiger_crmentity';
$field7->column = 'modifiedtime';
$field7->uitype = 70;
$field7->typeofdata = 'T~O';
$field7->displaytype= 2;
$block->addField($field7);
// Filter Setup
$filter1 = new Vtiger_Filter();
$filter1->name = 'All';
$filter1->isdefault = true;
$module->addFilter($filter1);
// Add fields to the filter create
$filter1->addField($field7, 2);
$filter1->addField($field3, 3);
$filter1->addField($field4, 5);
/** Set sharing access of this module */
$module->setDefaultSharing();
/** Enable and Disable available tools */
$module->enableTools(Array('Import', 'Export'));
$module->disableTools('Merge');
?>
You can also refer Entity-Module-Documentation

Related

How to sort randomly with Doctrine DBAL, TYPO3 and TypoScript

Creating a query by TypoScript in TYPO3 v8 the Doctrine-Framework is already used to create the SQL-query. The following code throws an error but was possible in former TYPO3 versions:
lib.myElement = CONTENT
lib.myElement {
wrap = <div class="inner-wrapper">|</div>
required = 1
table = tt_content
select.languageField = sys_language_uid
select.pidInList = {$pidConstant}
select.max = 1
select.where = colPos = 0
select.orderBy = RAND()
select.selectFields = bodytext,image,header,header_link
renderObj=COA
renderObj{
...
}
}
In TYPO3 version 8 now is an error logged with this essence:
{"exception":"Doctrine\\DBAL\\Driver\\Mysqli\\MysqliException: Unknown column 'rand()' in 'order clause'...}
So is it still possible to sort randomly and if yes, what's the trick to get it running on base of the TypoScript above?
The trick is to add RAND() to the fieldlist and assign an alias. The alias can be used for sorting.
lib.myElement = CONTENT
lib.myElement {
wrap = <div class="inner-wrapper">|</div>
required = 1
table = tt_content
select.languageField = sys_language_uid
select.pidInList = {$pidConstant}
select.max = 1
select.where = colPos = 0
select.orderBy = my_alias
select.selectFields = bodytext,image,header,header_link,RAND() as my_alias
renderObj=COA
renderObj{
...
}
}

how to add extra price to cart programmatically in prestahop 1.7

Am new to prestashop 1.7. I want to add extra cost for customization product on adding to cart in prestashop 1.7. Please any body help me.
add own customization data to cart.
$idProduct = Tools::getValue('pid'); // for me it's always one
$qty=Tools::getValue('qty'); // always add one item
$token = Tools::getValue('token');
$customData_front = Tools::getValue('front_view');
$customData_back = Tools::getValue('back_view');
$customData = Tools::getValue('customdata');
$attribute =Tools::getValue('id_product_attribute')
if (is_null($this->context->cart->id)) {
$this->context->cart->add();
$this->context->cookie->__set('id_cart', $this->context->cart->id);
}
// get cart id if exists
if ($this->context->cookie->id_cart)
{
$cart = new Cart($this->context->cookie->id_cart);
}
// create new cart if needed
if (!isset($cart) OR !$cart->id)
{
$cart = new Cart($this->context->cookie->id_cart);
$cart->id_customer = (int)($this->context->cookie->id_customer);
$cart->id_address_delivery = (int) (Address::getFirstCustomerAddressId($cart->id_customer));
$cart->id_address_invoice = $cart->id_address_delivery;
$cart->id_lang = (int)($this->context->cookie->id_lang);
$cart->id_currency = (int)($this->context->cookie->id_currency);
$cart->id_carrier = 1;
$cart->recyclable = 0;
$cart->gift = 0;
$cart->add();
$this->context->cookie->id_cart = (int)($cart->id);
}
$product = new Product((int)$idProduct);
if ($attribute > 0) {
$minimal_quantity = (int)Attribute::getAttributeMinimalQty($this->id_product_attribute);
} else {
$minimal_quantity = (int)$product->minimal_quantity;
}
// add customizatated text
$check =serialize($customData);
$id_address_delivery = $cart->id_address_delivery;
$customization = $this->context->cart->addTextFieldToProduct((int)($idProduct), 9, Product::CUSTOMIZE_TEXTFIELD, serialize($customData));
$exising_customization = Db::getInstance()->executeS('SELECT id_customization FROM '._DB_PREFIX_.'customized_data ORDER BY id_customization DESC LIMIT 0,1');
$customization = $exising_customization[0]['id_customization'];
Db::getInstance()->execute('UPDATE ps_customization SET in_cart = 1, id_product_attribute = '.$attribute.',id_address_delivery='.$id_address_delivery.',quantity='.$minimal_quantity.' WHERE id_customization = ' .$customization);
// get product to add into cart
$productToAdd = new Product((int)($idProduct), true, (int)($this->context->cookie->id_lang));
$cart->update();
$this->context->cart->updateQty((int)($qty),(int)($idProduct),(int)($attribute),$customization,'up',(int)($id_address_delivery));
$cart->update();
In that I want add additional cost every customization.

Aspose.pdf.Heading text went to out of the page - DOM pdf approach

I am trying to build list text using the heading objects. While entering the text into heading text, the list text is went to out of the page.
Document pdfDoc = new Document();
pdfDoc.PageInfo.Width = 612.0;
pdfDoc.PageInfo.Height = 792.0;
pdfDoc.PageInfo.Margin = new MarginInfo();
pdfDoc.PageInfo.Margin.Left = 72;
pdfDoc.PageInfo.Margin.Right = 72;
pdfDoc.PageInfo.Margin.Top = 72;
pdfDoc.PageInfo.Margin.Bottom = 72;
Page pdfPage = pdfDoc.Pages.Add();
pdfPage.PageInfo.Width = 612.0;
pdfPage.PageInfo.Height = 792.0;
pdfPage.PageInfo.Margin = new MarginInfo();
pdfPage.PageInfo.Margin.Left = 72;
pdfPage.PageInfo.Margin.Right = 72;
pdfPage.PageInfo.Margin.Top = 72;
pdfPage.PageInfo.Margin.Bottom = 72;
Heading heading = new Heading(0);
heading.Text = "(a) Text contends that the trial incorrectly completed the Support Worksheet that accompanied the trial. Calculation of the resulting Calculation of the resulting modified child support amount.";
pdfPage.Paragraphs.Add(heading);
string outFile = "D:/Text_Xhtmls/Heading.pdf";
Please find the image for your reference- image

gSoap Exchange Web Services Connection

I'm trying to write an application that would work with the EWS proxy classes. To generate proxy classes I used gsoap (compiled OpenSSL).
I have implemented a library that works with EWS, but. Net.
The problem is this: I have no idea how to implement a connection to the server.
Doing the following:
ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy("https://192.168.0.49/EWS/exchange.asmx");
soap *pSoap = proxy->soap;
pSoap->userid = "user1";
pSoap->passwd = "password1";
pSoap->recv_timeout = 300;
pSoap->send_timeout = 300;
SOAP_ENV__Header *header = new SOAP_ENV__Header();
header->ns3__RequestServerVersion = new _ns3__RequestServerVersion();
header->ns3__RequestServerVersion->soap = pSoap;
header->ns3__RequestServerVersion->Version = ns3__ExchangeVersionType__Exchange2010;
pSoap->header = header;
//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;
//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;
//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;
int error = proxy->GetFolder(gftRoot, response);
As a result, getting the error: SLL_ERROR.
I know, that i`m doing something wrong. But what? What i should to do, to use proxy classes functions?
I resolved it by myself:
Added to project LibNTLM and added to preprocessor WITH_NTLM.
Also changed code, a little bit:
ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy(endpoint.c_str());
soap *pSoap = proxy->soap;
pSoap->userid = "Ivan1";
pSoap->passwd = "1";
pSoap->ntlm_challenge = "";
pSoap->authrealm = "Ursa-Minor";
pSoap->ssl_flags = SOAP_SSL_NO_AUTHENTICATION;
//pSoap->keep_alive = true;
pSoap->mode = SOAP_IO_KEEPALIVE;
//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;
//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;
//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__size_NonEmptyArrayOfBaseFolderIdsType = 1;
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderIds = (ns3__NonEmptyArrayOfBaseFolderIdsType*)dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;
int qq = proxy->GetFolder(gftRoot, response);
return true;
But now i have enother problems: Error 500: Internal Server Error

Dynamics CRM Web Service Execute returns "Server was unable to process request."

I'm going crazy here with DCRM web services,
I'm trying to create a Connection between two leads dynamically.
I'm getting the following error:
"0x80040216
An unexpected error occurred.
Platform
An unexpected error occurred.
Type:Microsoft.Crm.CrmException ErrorCode:0x80040216
Object reference not set to an instance of an object."
Here is my code:
Guid connectionRoleID = new Guid("64f33a74-0342-e211-b55e-00155d00041e");
connectionroleobjecttypecode connroleobjecttypecode = new connectionroleobjecttypecode() { connectionroleid = new Lookup(){Value = connectionRoleID}, associatedobjecttypecode = EntityName.lead.ToString()};
connection conn = new connection();
List<Property> list = new List<Property>();
Lookup lookup = new Lookup();
lookup.Value = customers[i].ID.Value.Value;
lookup.name = EntityName.lead.ToString();
Lookup lookup2 = new Lookup();
lookup2.Value = customers[j].ID.Value.Value;
lookup2.name = EntityName.lead.ToString();
conn.record1roleid = new Lookup() { name = "duplicate", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
conn.record2roleid = new Lookup() { name = "duplicate", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
list.Add(new LookupProperty(){Name = "record1id", Value = lookup});
list.Add(new LookupProperty(){Name = "record2id", Value = lookup2});
list.Add(new LookupProperty(){Name = "record1roleid", Value = conn.record1roleid});
list.Add(new LookupProperty() { Name = "record2roleid", Value = conn.record2roleid });
I've tried tracing (which did not help), and in the eventviewer I get an error, but there is no helpful information.
I'm dying here! Please help... :-)
I think its because you are doing:
conn.record1roleid = new Lookup() { name = "duplicate", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
name should be the name of an entity, e.g. contact, lead, incident. In this case I believe you should be using: connectionrole.
conn.record1roleid = new Lookup() { name = "connectionrole", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
I would suggest having at Sample: Create a Connection (Early Bound).
Add type for the entity to lookup
Lookup lookup2 = new Lookup();
lookup2.Value = customers[j].ID.Value.Value;
lookup2.name = EntityName.lead.ToString();
**lookup2.type = "lead";**