Skip to content

Instantly share code, notes, and snippets.

@betobaz
Created March 13, 2014 18:14
Show Gist options
  • Save betobaz/9533729 to your computer and use it in GitHub Desktop.
Save betobaz/9533729 to your computer and use it in GitHub Desktop.
fill_dropdown_custom
<?php
/*********************************************************************************
* By installing or using this file, you are confirming on behalf of the entity
* subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
* the SugarCRM Inc. Master Subscription Agreement (“MSA”), which is viewable at:
* http://www.sugarcrm.com/master-subscription-agreement
*
* If Company is not bound by the MSA, then by installing or using this file
* you are agreeing unconditionally that Company will be bound by the MSA and
* certifying that you have authority to bind Company accordingly.
*
* Copyright (C) 2004-2013 SugarCRM Inc. All rights reserved.
********************************************************************************/
// THIS CONTENT IS GENERATED BY MBPackage.php
$manifest = array (
0 =>
array (
'acceptable_sugar_versions' =>
array (
0 => '7.1.*',
),
),
1 =>
array (
'acceptable_sugar_flavors' =>
array (
0 => 'PRO',
1 => 'ENT',
),
),
'readme' => '',
'key' => '',
'author' => 'Pedro Alberto Bazan Serrano',
'description' => 'Crea, actualiza y reemplaza listas desplegables',
'icon' => '',
'is_uninstallable' => true,
'name' => 'fill_dropdown',
'published_date' => '2013-12-03 11:05:23',
'type' => 'module',
'version' => '0.1',
);
$installdefs = array (
'id' => 'fill_dropdown',
);
$app_list_strings_custom = array (
array (
"name" => "my_list_01",
"list" => array(
"" => "",
"1" => "1",
"2" => "2",
"3" => "3",
),
),
array (
"name" => "my_list_02",
"list" => array(
"" => "",
"a" => "a",
"b" => "b",
"c" => "c",
),
),
);
<?php
require_once ('modules/ModuleBuilder/MB/ModuleBuilder.php') ;
require_once('modules/ModuleBuilder/parsers/parser.dropdown.php');
function post_install()
{
global $app_list_strings, $current_language;
include "app_list_strings_custom.php";
$_REQUEST['view_package'] = 'studio';
foreach ($app_list_strings_custom as $list_data) {
$listEncode = encodeList($list_data['list']);
$list = "[".implode(",", $listEncode)."]";
$parserDropDown = new ParserDropDown();
$parserDropDown->saveDropDown(array(
'dropdown_lang' => $current_language,
'dropdown_name' => $list_data['name'],
'view_package' => 'studio',
'view_module' => '',
'list_value' => $list,
));
"<br> Lista guardada: " . $list_data['name'];
}
}
function encodeList($list){
$listEncode = array();
foreach($list as $key => $item ){
$listEncode[] = <<<text
["$key","$item"]
text;
}
return $listEncode;
}
@mehulsbhandari
Copy link

How do i delete cache folder from here.. ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment