I am wondering how to create custom module in SugarCRM and show link into the menu bar. So my custom module will not be a Bean, but needs to be visible in menu bar.
My manifest.php file is as follows:
$manifest = array(
'acceptable_sugar_versions' => array(
"rege_matches" => array("5.1.*")
),
'acceptable_sugar_flavors' => array(
'CE'
),
'name' => 'CustomModule',
'version' => '1.0',
'description' => 'CustomModule for SugarCRM',
'author' => 'Community',
'published_date' => '2015/02/17',
'type' => 'module',
'icon' => 'icons/default/icon_CustomModule.gif',
'is_uninstallable' => 'true',
);
$installdefs = array(
'id'=> 'CustomModule',
'copy' => array (
array (
'from' => '<basepath>/package/CustomModule',
'to' => 'modules/CustomModule',
),
),
'language' => array(
array(
'language'=> 'en_us',
'from'=> '<basepath>/package/language/application/en_us.lang.php',
'to_module' => 'application',
'language' => 'en_us',
),
),
);
Thanks!
Related
I'm new to contao . I created a backend custom module . The listing of records is looking fine.But When I trying to delete or copy the record the system returns internal server error.And also can't edit pre-saved records.Screenshots are attached below.Please help me.
// List
'list' => array
(
'sorting' => array
(
'mode' => 1,
'fields' => array('title'),
'flag' => 1,
'panelLayout' => 'filter;search,limit'
),
'label' => array
(
'fields' => array('title', 'teaser'),
'format' => '%s <span style="color:#b3b3b3;padding-left:3px;">[%s]</span>'
),
'global_operations' => array
(
'all' => array
(
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"'
)
),
'operations' => array
(
'editheader' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_solutions']['editheader'],
'href' => 'act=edit',
'icon' => 'edit.gif'
),
'copy' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_solutions']['copy'],
'href' => 'act=copy',
'icon' => 'copy.gif'
),
'delete' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_solutions']['delete'],
'href' => 'act=delete',
'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\'))return false;Backend.getScrollOffset()"'
),
'show' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_solutions']['show'],
'href' => 'act=show',
'icon' => 'show.gif'
)
)
),
I have create a custom view from scratch in SugarCRM PRO 7.6 displaying only the text "Hello World" and placed that view inside a custom layout created to display that view.
With the modifications i have made i have suucceded in displaying the "Hello World" view inside my newly created layout but i am not succeded in displaying anything in the header pane available right over my custom view.
The folder structure of my layout and view is shown below:
All the four files along with their containg code are shown below:
helloworldlayout.js
({})
helloworldlayout.php
<?php
$viewdefs['Accounts']['base']['layout']['helloworldlayout'] = array(
'components' => array(
array(
'layout' => array(
'components' => array(
array(
'layout' => array(
'components' => array(
array(
'view' => 'helloworldview',
'primary' => true,
),
),
'type' => 'simple',
'name' => 'main-pane',
'span' => 8,
),
),
array(
'layout' => array(
'components' => array(
array(
'layout' => 'sidebar',
),
),
'type' => 'simple',
'name' => 'side-pane',
'span' => 4,
),
),
array(
'layout' => array(
'components' => array(
array(
'layout' => array(
'type' => 'dashboard',
'last_state' => array(
'id' => 'last-visit',
)
),
'context' => array(
'forceNew' => true,
'module' => 'Home',
),
),
),
'type' => 'simple',
'name' => 'dashboard-pane',
'span' => 4,
),
),
array(
'layout' => array(
'components' => array(
array(
'layout' => 'preview',
),
),
'type' => 'simple',
'name' => 'preview-pane',
'span' => 8,
),
),
),
'type' => 'default',
'name' => 'sidebar',
'span' => 12,
),
),
),
'type' => 'record',
'name' => 'base',
'span' => 12,
);
helloworldview.js
({})
helloworldview.hbs
<h1>Hello World</h1>
Finally I am accessing this Hello World view using:
<my_sugar_instance>/#Accounts/layout/helloworldlayout
Can any body guide me what are the best practices to configure the header pane highlighted in the image shown below:
The problem is that 'view' => 'helloworldview' is too nested within helloworldlayout.php. For example, if you use the following code as your helloworldlayout.php:
<?php
$viewdefs['Accounts']['base']['layout']['helloworldlayout'] = array(
'components' => array(
array(
'view' => 'helloworldview',
),
),
'type' => 'simple',
'name' => 'base',
'span' => 12,
);
Then you will observe that there's no space:
helloworld without spaces
Take a look at the following solution suggested by Tevfik Tümer
https://community.sugarcrm.com/thread/27826
I'm working on a module and I would like to know how to add multiple dropdown with fields_options.
$this->fields_options = array(
'Test' => array(
'title' => $this->l('Test'),
'icon' => 'delivery',
'fields' => array(
'IXY_GALLERY_CREATION_OCCASION' => array(
'title' => $this->l('DropdownList'),
'type' => 'select',
'multiple' => true , // not working
'identifier' => 'value',
'list' => array(
1 => array('value' => 1, 'name' => $this->l('Test 1 ')),
2 => array('value' => 2, 'name' => $this->l('Test 2)'))
)
),
),
'description' =>'',
'submit' => array('title' => $this->l('Save'))
)
);
This is how I'm doin if you're meaning that :
$combo = $this->getAddFieldsValues();
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Title'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'select',
'lang' => true,
'label' => $this->l('Nom'),
'name' => 'nom_matiere',
'options' => array(
'query' => $combo[0],
'id' => 'id_option',
'name' => 'name'
)
),
array(
'type' => 'select',
'lang' => true,
'label' => $this->l('Nom'),
'name' => 'name',
'options' => array(
'query' => $combo[1],
'id' => 'id_option',
'name' => 'name'
)
),
),
),
'submit' => array(
'title' => $this->l('Save'),
'name' => $this->l('updateData'),
)
),
);
the answer are not correctly .. due its not only dfined the field in the database, also must capture and stored in special way the values, in this example i demostrate to store as "1,2,3,6,8" using a single field
THE COMPLETE CODE AND ALL THE STEPS ARE AT: https://groups.google.com/forum/m/?hl=es#!topic/venenuxsarisari/z8vfPsvFFjk
here i put only the most important parts..
as mentioned int he previous link, added a new fiel in the model definition, class and the table sql
this method permits to stored in the db as "1,2,3" so you can use only a single field to relation that multiple selected values, a better could be using groupbox but its quite difficult, take a look to the AdminCustomers controller class in the controllers directory of the prestachop, this has a multiselect group that used a relational table event stored in single field
then in the helper form list array of inputs define a select as:
at the begining dont foget to added that line:
// aqui el truco de guardar el multiselect como una secuencia separada por comas, mejor es serializada pero bueh
$this->fields_value['id_employee[]'] = explode(',',$obj->id_employee);
this $obj are the representation of the loaded previous stored value when go to edit ... from that object, get the stored value of the field of your multiselect, stored as "1,3,4,6"
and the in the field form helper list of inputs define the select multiple as:
array(
'type' => 'select',
'label' => $this->l('Select and employee'),
'name' => 'id_employee_tech',
'required' => false,
'col' => '6',
'default_value' => (int)Tools::getValue('id_employee_tech'),
'options' => array(
'query' => Employee::getEmployees(true), // el true es que solo los que estan activos
'id' => 'id_employee',
'name' => 'firstname',
'default' => array(
'value' => '',
'label' => $this->l('ninguno')
)
)
),
an then override the post process too
public function postProcess()
{
if (Tools::isSubmit('submitTallerOrden'))
{
$_POST['id_employee'] = implode(',', Tools::getValue('id_employee'));
}
parent::postProcess();
}
this make stored in the db as "1,2,3"
How can I add a class to a select drop down list.
Below is my attempt to do it. I have tried to do it with the attributes but this doesn't appear to work with select tag.
$this->add(
array(
'type' => 'DoctrineModule\Form\Element\ObjectSelect',
'name' => 'jobId',
'options' => array(
'object_manager' => $this->getObjectManager(),
'target_class' => 'FormDependencies\Entity\JobList',
'property' => 'job',
'empty_option' => '--- please choose ---',
'attributes' => array(
'class' => 'testing',
)
),
)
);
Thank you in advance for your help.
below is the rendered input bar: you will see that the class has not been added;
<select name="Jobs[jobId]">
The attributes array should not be nested within options; but rather on the same level.
$this->add(array(
'name' => 'jobId',
'type' => 'DoctrineModule\Form\Element\ObjectSelect',
'options' => array(
'foo' => 'bar'
),
'attributes' => array(
'class' => 'testing',
),
));
i have this form:
$this->addElement (
'multiCheckbox', 'servers2',
array (
'checkedValue' => '0',
'multiOptions' => array(
'11.com' => '.com',
'12.com' => '12.com',
'16.com' => '16.com',
'3.com' => '17.com'
)
));
the problem is that the checkedValue doesn't work for this setup, it does for a simple checkbox. I've also tried 'checkedValues' => array('1','0'), singular or plural,
but no end in sight.
any ideas?
THanks
To mark certain checkboxes as checked, try this:
$multiCheckElement->setValue(array('11.com', '3.com'));
// or
$this->addElement (
'multiCheckbox', 'servers2',
array (
'value' => array('11.com', '3.com'), // select these 2 values
'multiOptions' => array(
'11.com' => '.com',
'12.com' => '12.com',
'16.com' => '16.com',
'3.com' => '17.com'
)
)
);
See also Zend_Form_Element_MultiCheckbox
ZF2 will require you to use value_options;
$form->add(
array(
'name' => 'servers2',
'type' => \Zend\Form\Element\MultiCheckbox::class,
'attributes' => array(
'id' => 'servers2',
'class' => 'form-control',
),
'options' => array(
'label' => 'Servers 2',
'column-size' => 'sm-10',
'label_attributes' => array('class' => 'col-sm-2'),
'twb-layout' => 'horizontal',
'value_options' => array(
'11.com' => '.com',
'12.com' => '12.com',
'16.com' => '16.com',
'3.com' => '17.com'
)
),
)
);
To specify the checked options, as seen at
use the 'selected' => true attribute:
$options = array(
array(
'value' => '0',
'label' => 'Apple',
'selected' => false,
'disabled' => false,
'attributes' => array(
'id' => 'apple_option',
'data-fruit' => 'apple',
),
'label_attributes' => array(
'id' => 'apple_label',
),
),
array(
'value' => '1',
'label' => 'Orange',
'selected' => true,
),
array(
'value' => '2',
'label' => 'Lemon',
),
);