salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.55k stars 2.1k forks source link

Studio Dynamic DropDown not working #929

Closed adamjakab closed 8 years ago

adamjakab commented 8 years ago

Hi,

ref.:(https://www.suitecrm.com/forum/developer-help/260-dynamic-dropdown-inside-studio)

When I select Data Type===Dynamic DropDown neither the "dropdown list" selection option nor the "Parent dropdown" options appare on the field configuration form.

Is this only my issue or is this something you know of:

the response from server on data type selection (index.php?to_pdf=1&sugar_body_only=1&module=ModuleBuilder&action=modulefield&view_package=&view_module=Calls&field=&type=dynamicenum) is:

{"east":{"title":"Edit Field","crumb":"","content":"<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000"><\/div>\n\n<script>\naddForm('popup_form');\n<\/script>\n\n\n<form name='popup_form' id='popup_form_id' onsubmit='return false;'>\n<input type='hidden' name='module' value='ModuleBuilder'>\n<input type='hidden' name='action' value='saveField'>\n<input type='hidden' name='new_dropdown' value=''>\n<input type='hidden' name='to_pdf' value='true'>\n<input type='hidden' name='view_module' value='Calls'>\n<input type='hidden' name='is_update' value='true'>\n\t\t &nbsp;\n\t <input type='button' class='button' name='fsavebtn' value='Save' \n\t\t\tonclick='if(validate_type_selection() && check_form("popup_form")){ ModuleBuilder.submitForm("popup_form_id"); }'>\n\t <input type='button' name='cancelbtn' value='Cancel' \n\t\t\tonclick='ModuleBuilder.tabPanel.removeTab(ModuleBuilder.findTabById("east"));' class='button'>\n\t \t\n\t<hr>\n\n<table width="400px" >\n<tr>\n <td class="mbLBL" style="width:92px;">Data Type:<\/td>\n <td > <select name="type" id="type" onchange="ModuleBuilder.moduleLoadField(&quot;&quot;, this.options[this.selectedIndex].value);">\n<option label="Address" value="address">Address<\/option>\n<option label="Checkbox" value="bool">Checkbox<\/option>\n<option label="Currency" value="currency">Currency<\/option>\n<option label="Date" value="date">Date<\/option>\n<option label="Datetime" value="datetimecombo">Datetime<\/option>\n<option label="Decimal" value="decimal">Decimal<\/option>\n<option label="Dynamic DropDown" value="dynamicenum" selected="selected">Dynamic DropDown<\/option>\n<option label="DropDown" value="enum">DropDown<\/option>\n<option label="Float" value="float">Float<\/option>\n<option label="HTML" value="html">HTML<\/option>\n<option label="IFrame" value="iframe">IFrame<\/option>\n<option label="Image" value="image">Image<\/option>\n<option label="Integer" value="int">Integer<\/option>\n<option label="MultiSelect" value="multienum">MultiSelect<\/option>\n<option label="Phone" value="phone">Phone<\/option>\n<option label="Radio" value="radioenum">Radio<\/option>\n<option label="Relate" value="relate">Relate<\/option>\n<option label="TextArea" value="text">TextArea<\/option>\n<option label="URL" value="url">URL<\/option>\n<option label="TextField" value="varchar">TextField<\/option>\n<\/select>\n\n <img border="0"\n onclick="return SUGAR.util.showHelpTips(this,'Select the appropriate data type based on the type of data that will be entered into the field.','','' );"\n src="themes\/SuiteR\/images\/helpInline.gif?v=qpfPYVYLEUIKrVoEpWv_Eg"\n alt="Information"\n class="inlineHelpTip"\n \/>\n <input type='hidden' name='type' value=dynamicenum \/>\n <\/td>\n<\/tr>\n<\/table>\n\n\n\n<table width="100%">\n<tr>\n\t<td class='mbLBL' width='30%' >Field Name:<\/td>\n\t<td>\n\t\t\t<input id="field_name_id" maxlength=28 type="text" name="name" value=""\n\t\t onchange="\n\t\tdocument.getElementById('label_keyid').value = 'LBL'+document.getElementById('field_name_id').value.toUpperCase();\n\t\tdocument.getElementById('label_value_id').value = document.getElementById('field_nameid').value.replace(\/_+\/g,' ').replace(\/^\s\s\/, '').replace(\/\s\s_$\/, '');\n\t\tdocument.getElementById('field_name_id').value = document.getElementById('field_name_id').value.toLowerCase();" \/>\n\t\t\t<script>\n\t\taddToValidate('popupform', 'name', 'DBName', true,'Field Name [a-zA-Z]' );\n\t\taddToValidateIsInArray('popup_form', 'name', 'in_array', true,'Reserved Keyword', '["ADD","EXCEPT","PERCENT","ALL","EXEC","PLAN","ALTER","EXECUTE","PRECISION","AND","EXISTS","PRIMARY","ANY","EXIT","PRINT","AS","FETCH","PROC","ASC","FILE","PROCEDURE","AUTHORIZATION","FILLFACTOR","PUBLIC","BACKUP","FOR","RAISERROR","BEGIN","FOREIGN","READ","BETWEEN","FREETEXT","READTEXT","BREAK","FREETEXTTABLE","RECONFIGURE","BROWSE","FROM","REFERENCES","BULK","FULL","REPLICATION","BY","FUNCTION","RESTORE","CASCADE","GOTO","RESTRICT","CASE","GRANT","RETURN","CHECK","GROUP","REVOKE","CHECKPOINT","HAVING","RIGHT","CLOSE","HOLDLOCK","ROLLBACK","CLUSTERED","IDENTITY","ROWCOUNT","COALESCE","IDENTITY_INSERT","ROWGUIDCOL","COLLATE","IDENTITYCOL","RULE","COLUMN","IF","SAVE","COMMIT","IN","SCHEMA","COMPUTE","INDEX","SELECT","CONSTRAINT","INNER","SESSION_USER","CONTAINS","INSERT","SET","CONTAINSTABLE","INTERSECT","SETUSER","CONTINUE","INTO","SHUTDOWN","CONVERT","IS","SOME","CREATE","JOIN","STATISTICS","CROSS","KEY","SYSTEM_USER","CURRENT","KILL","TABLE","CURRENT_DATE","LEFT","TEXTSIZE","CURRENT_TIME","LIKE","THEN","CURRENT_TIMESTAMP","LINENO","TO","CURRENT_USER","LOAD","TOP","CURSOR","NATIONAL","TRAN","DATABASE","NOCHECK","TRANSACTION","DBCC","NONCLUSTERED","TRIGGER","DEALLOCATE","NOT","TRUNCATE","DECLARE","NULL","TSEQUAL","DEFAULT","NULLIF","UNION","DELETE","OF","UNIQUE","DENY","OFF","UPDATE","DESC","OFFSETS","UPDATETEXT","DISK","ON","USE","DISTINCT","OPEN","USER","DISTRIBUTED","OPENCONNECTOR","VALUES","DOUBLE","OPENQUERY","VARYING","DROP","OPENROWSET","VIEW","DUMMY","OPENXML","WAITFOR","DUMP","OPTION","WHEN","ELSE","OR","WHERE","END","ORDER","WHILE","ERRLVL","OUTER","WITH","ESCAPE","OVER","WRITETEXT","ANALYZE","ASENSITIVE","BEFORE","BIGINT","BINARY","BOTH","CALL","CHANGE","CHARACTER","CONDITION","DATABASES","DAY_HOUR","DAY_MICROSECOND","DAY_MINUTE","DAY_SECOND","DEC","DECIMAL","DELAYED","DESCRIBE","DETERMINISTIC","DISTINCTROW","DIV","DUAL","EACH","ELSEIF","ENCLOSED","ESCAPED","EXPLAIN","FALSE","FLOAT","FLOAT4","FLOAT8","FORCE","FULLTEXT","HIGH_PRIORITY","HOUR_MICROSECOND","HOUR_MINUTE","HOUR_SECOND","IGNORE","INFILE","INOUT","INSENSITIVE","INT","INT1","INT2","INT3","INT4","INT8","INTEGER","ITERATE","KEYS","LEADING","LEAVE","LIMIT","LINES","LOCALTIME","LOCALTIMESTAMP","LOCK","LONGBLOB","LONGTEXT","LOOP","LOW_PRIORITY","MATCH","MEDIUMBLOB","MEDIUMINT","MEDIUMTEXT","MIDDLEINT","MINUTE_MICROSECOND","MINUTE_SECOND","MOD","MODIFIES","NATURAL","NO_WRITE_TO_BINLOG","NUMERIC","OPTIMIZE","OPTIONALLY","OUT","OUTFILE","PURGE","READS","REAL","REGEXP","RELEASE","RENAME","REPEAT","REPLACE","REQUIRE","RLIKE","SCHEMAS","SECOND_MICROSECOND","SENSITIVE","SEPARATOR","SHOW","SMALLINT","SONAME","SPATIAL","SPECIFIC","SQL","SQLEXCEPTION","SQLSTATE","SQLWARNING","SQL_BIG_RESULT","SQL_CALC_FOUND_ROWS","SQL_SMALL_RESULT","SSL","STARTING","STRAIGHT_JOIN","TERMINATED","TINYBLOB","TINYINT","TINYTEXT","TRAILING","TRUE","UNDO","UNLOCK","UNSIGNED","USAGE","USING","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","VARBINARY","VARCHARACTER","WRITE","XOR","YEAR_MONTH","ZEROFILL","CONNECTION","LABEL","UPGRADE","DATE","VARCHAR","VARCHAR2","NVARCHAR2","CHAR","NCHAR","NUMBER","PLS_INTEGER","BINARY_INTEGER","LONG","TIMESTAMP","INTERVAL","RAW","ROWID","UROWID","MLSLABEL","CLOB","NCLOB","BLOB","BFILE","XMLTYPE","ID","ID_C","PARENT_NAME","PARENT_ID","AOK_KNOWLEDGEBASE_ID","MKT_OFFERS_ID","AOS_QUOTES_ID","JJWG_MARKERS_ID","MKT_CODICI_ATECO_ID","MEETING_ID","JJWG_AREAS_ID","JJWG_MAPS_ID","AOS_INVOICES_ID","MKT_WORKLOGS_ID","NOTE_ID","AOK_KNOWLEDGE_BASE_CATEGORIES_ID","AOR_SCHEDULED_REPORTS_ID","AOR_REPORT_ID","FP_EVENTS_ID","AM_PROJECTTEMPLATES_ID","AOS_PDF_TEMPLATES_ID","ACCOUNT_ID","DOCUMENT_ID","AOS_PRODUCTS_ID","JJWG_ADDRESS_CACHE_ID","USER_ID","AM_TASKTEMPLATES_ID","BUG_ID","SECURITYGROUP_ID","PROJECT_ID","PROJECTTASK_ID","CONTACT_ID","CALL_ID","AOS_CONTRACTS_ID","ACASE_ID","MKT_COMMERCIAL_ZONES_ID","AOS_PRODUCTS_QUOTES_ID","OPPORTUNITY_ID","FP_EVENT_LOCATIONS_ID","TASK_ID","MKT_OFFERS_LINES_ID","CAMPAIGN_ID","AOS_PRODUCT_CATEGORIES_ID","PROSPECT_ID","LEAD_ID"]', 'u==');\n\t\t\t\n\t\taddToValidateIsInArray('popup_form', 'name', 'in_array', true, 'Field Name already exists', '["ID","NAME","DATE_ENTERED","DATE_MODIFIED","MODIFIED_USER_ID","CREATED_BY","DESCRIPTION","DELETED","ASSIGNED_USER_ID","DURATION_HOURS","DURATION_MINUTES","DATE_START","DATE_END","PARENT_TYPE","STATUS","DIRECTION","PARENT_ID","REMINDER_TIME","EMAIL_REMINDER_TIME","EMAIL_REMINDER_SENT","OUTLOOK_ID","REPEAT_TYPE","REPEAT_INTERVAL","REPEAT_DOW","REPEAT_UNTIL","REPEAT_COUNT","REPEAT_PARENT_ID","RECURRING_SOURCE","ATECO","BILLING_ADDRESS_POSTALCODE","ASSIGNED_CLIENT","FT_ANNO_MENO_UNO","PROFITABILITY","CALL_PERIOD","FT_PERIODO_ATTUALE","RESULT","BILLING_ADDRESS_CITY","COMPANY_STATUS","LOCATION_ZONE","OFFICE_PHONE","BILLING_ADDRESS_STREET","CURRENCY_ID","CAMPAGNA_TELEFONICA","TESTDYNDROP","INDUSTRY","FT_PERIODO_MOBILE","NEGATIVE_REASON","TARGET"]', 'u==');\n\t\t\t\n\t\t<\/script>\n\t<\/td>\n<\/tr>\n<tr>\n\t<td class='mbLBL'>Display Label:<\/td>\n\t<td>\n\t\t<input id="label_value_id" type="text" name="labelValue" value="">\n\t<\/td>\n<\/tr>\n<tr>\n\t<td class='mbLBL'>System Label:<\/td>\n\t<td>\n \t <input id ="label_key_id" type="text" name="label" value="">\n\t\t<\/td>\n<\/tr>\n<tr>\n\t<td class='mbLBL'>Help Text:<\/td><td><input type="text" name="help" value="">\t<\/td>\n<\/tr>\n<tr>\n <td class='mbLBL'>Comment Text:<\/td><td><input type="text" name="comments" value=""> <\/td>\n<\/tr><tr>\n\t<td class='mbLBL'>Default Value:<\/td>\n\t<td>\n\t\t\t<input type='text' name='default' id='default' value='' maxlength='100'>\n\t\t<\/td>\n<\/tr>\n<tr>\n\t<td class='mbLBL'>Max Size:<\/td>\n\t<td>\n\t\t\t<input type='text' name='len' id='field_len' value='100' onchange="forceRange(this,1,255);changeMaxLength(document.getElementById('default'),this.value);">\n\t\t<input type='hidden' id="orig_len" name='orig_len' value='100'>\n\t\t\t\t\n\t\t<script>\n\t\tfunction forceRange(field, min, max){\n\t\t\tfield.value = parseInt(field.value);\n\t\t\tif(field.value == 'NaN')field.value = max;\n\t\t\tif(field.value > max) field.value = max;\n\t\t\tif(field.value < min) field.value = min;\n\t\t}\n\t\tfunction changeMaxLength(field, length){\n\t\t\tfield.maxLength = parseInt(length);\n\t\t\tfield.value = field.value.substr(0, field.maxLength);\n\t\t}\n\t\t<\/script>\n\t\t\n\t\t<\/td>\n<\/tr>\n\n\n<tr ><td class='mbLBL'>Required Field:<\/td><td><input type="checkbox" name="required" value="1" \/><\/td><\/tr>\n<tr><td class='mbLBL'>Audit:<\/td><td><input type="checkbox" name="audited" value="1" \/><\/td><\/tr>\n<tr><td class='mbLBL'>Inline Edit:<\/td><td><input type="hidden" name="inline_edit" value=""><input type="checkbox" name="inline_edit" value="1" CHECKED \/><\/td><\/tr>\n\n<tr><td class='mbLBL'>Importable:<\/td><td>\n <select name="importable" id="importable">\n<option label="Yes" value="true" selected="selected">Yes<\/option>\n<option label="No" value="false">No<\/option>\n<option label="Required" value="required">Required<\/option>\n<\/select>\n\n <img border="0"\n onclick="return SUGAR.util.showHelpTips(this,'&lt;b&gt;Yes&lt;\/b&gt;: The field will be included in an import operation.&lt;br&gt;&lt;b&gt;No&lt;\/b&gt;: The field will not be included in an import.&lt;br&gt;&lt;b&gt;Required&lt;\/b&gt;: A value for the field must be provided in any import.','','' );"\n src="themes\/SuiteR\/images\/helpInline.gif?v=qpfPYVYLEUIKrVoEpWv_Eg"\n alt="Information"\n class="inlineHelpTip"\n \/>\n <\/td><\/tr>\n<tr><td class='mbLBL'>Duplicate Merge:<\/td><td>\n <select name="duplicate_merge" id="duplicate_merge">\n<option label="Disabled" value="0" selected="selected">Disabled<\/option>\n<option label="Enabled" value="1">Enabled<\/option>\n<\/select>\n\n <img border="0"\n onclick="return SUGAR.util.showHelpTips(this,'&lt;b&gt;Enabled&lt;\/b&gt;: The field will appear in the Merge Duplicates feature, but will not be available to use for the filter conditions in the Find Duplicates feature.&lt;br&gt;&lt;b&gt;Disabled&lt;\/b&gt;: The field will not appear in the Merge Duplicates feature, and will not be available to use for the filter conditions in the Find Duplicates feature.','','' );"\n src="themes\/SuiteR\/images\/helpInline.gif?v=qpfPYVYLEUIKrVoEpWv_Eg"\n alt="Information"\n class="inlineHelpTip"\n \/>\n<\/td><\/tr>\n<\/table>\n<\/form>\n\n<script>\n\nfunction validate_type_selection(){\n var typeSel = document.getElementById('type');\n if(typeSel && typeSel.options){\n if(typeSel.options[typeSel.selectedIndex].value == ''){\n alert('Please Select a Field Type');\n return false;\n }\n }\n if (document.getElementById("customTypeValidate")){\n return document.getElementById("customTypeValidate").onchange(); \n }\n return true;\n}\n\nModuleBuilder.helpSetup('fieldsEditor','addField');\n<\/script>","action":"activate"}}

maxxatgit commented 8 years ago

I'm running SuiteCRM 7.5.1 on a CentOS vps, and I created a dynamic drop-down with no errors.

Regards

adamjakab commented 8 years ago

Hi @maxxatgit, thanx for the quick reply. I have the same suitecrm version(SuiteCrm Version 7.5.1, Sugar Version 6.5.20 (Build 1001)) fresh install on an Ubuntu server (LTS) with Php(Version 5.5.9-1) running php from Apache through CGI/FastCGI with entire site owned by user with which php is being executed (no permission problems). But no cookies! I have completely disabled the display of errors in php and xdebug and opcache is also disabled. Still no cookies. The response the server returns (see above) does not at all include the fields for dropdown selection or parent. I am logging all errors and notices (to file) but when I execute the request (change dropdown type to dynamicenum) there are no errors/warnings/notices being logged. What version of php are you running your instance on? tnx

maxxatgit commented 8 years ago

I'm running CentOS 6, Apache 2.2 with fcgid, and PHP 5.5. No cookies? Did you setup a custom sessions directory? I got some odd errors (really just a lot of session files) when I did that. How did you install? I have installed from both softaculous, and the tar archives. The instance where I added the dynamic dropdown was installed from softaculous.

adamjakab commented 8 years ago

hi @maxxatgit , [ ;) - sorry 'no cookies!' is some silly kiddy expression i picked up somewhere - it means 'No luck!' ] no, no custom session dir. I installed from zip from SuiteCRM official download page. You do not have any additional/custom module installed?

adamjakab commented 8 years ago

I think I got to the source of the problem. Can you pls confirm that in your working deployment you do have the following files: custom/modules/DynamicFields/templates/Fields/TemplateDynamicenum.php custom/modules/DynamicFields/templates/Fields/Forms/dynamicenum.php custom/modules/DynamicFields/templates/Fields/Forms/dynamicenum.tpl

these files are missing from the official SuiteCRM 7.5.1 download. If I put these files I do see in studio the fields for dropdown selection and parent. Still need to test functionality

adamjakab commented 8 years ago

I opened PR #935 for this

armadillotec commented 8 years ago

Same error here!

Dynamic Dropdown are not working in 7.5.1

it's easy to see that files are missing in 7.5.1

https://github.com/salesagility/SuiteCRM/tree/master/custom/modules

Regards

Landver commented 8 years ago

After I added that files. Problem had been solved. But there is another bug with dynamic dropdown.

Here is scenario: I created Dropdown Field "A" with dropdown list "a" After I created Dynamic Dropdown Field "B" with dropdown list "b"

After I put that in module that fields: "A" and after "B" So when I use Edit Mode, I can succesfully choose "A" that make filter in "B". So it works as it must be. BUT!!!! When I try do the same from Quick Create mode, I choose "A", but "B" don't filter nothing. I see all possible options in "B", like "B" it's just Dropdown Field, and not Dynamic Dropdown Field.

The same bug appear when I work from Detail View, when I try to edit "B" I see all possible options. And when I push Enter I see value, like: Firewall_Fortigate_80D, even if I must see only 80D

Landver commented 8 years ago

Problem solved. It was not bug. When I added that 2 files - I did that with root use, so apache user didn't have access to that files. When I solved problem with permitions - it solved problem with dynamic dropdown.

gunnicom commented 8 years ago

Are that files, that may have moved from custom to modules/DynamicFields/ ?

itglaafs commented 8 years ago

Hello,

I have similar problem as Landver described above with dynamic fields, all options are shown for child dropdown but only in edit mode and with Opportunities module. Once you click on parent dropdown and choose different value, everything is sorted out and you can see proper child list for related parent value, but on next edit you have to do it all over again.

This is all of course in Opportunities, the other modules are working fine. Have anyone experienced similar issue and perhaps resolved the same? Thank you very much.

Regards.