Hello everyone.
Im sorry about the mass of text, im just trying to provide as much information as possible.
We have a customer running SugarCRM Community Edition 5.2 on their own servers. As a PHP Expert i have been assigned for second lvl support even though i never had to deal with SugarCRM. Unfortunaly it used to be a project set up by a trainee, so there is no documentation and it looks pretty much messed up.
So basicaly i am reading sugarCRM books and trying to find out how things work together in their implementation.
There seem to be a problem with advanced search over accounts. Im a little bit stuck with this and hope you guys can face me into right direction.
So we got accounts with a couple of subpanels, default and advanced search form. The advanced search form seems to be particulary broken. When it is used to narrow accounts list, it works fine without any problems.
but...
Accounts can cooperate with each other . Therefore each account has a subpanel "cooperates with" which contains a list of accounts that cooperate with that particular account (n2n relationship). To add a new cooperation (pick another account) the advanced search form is called from "cooperates with" subpanel in a popup which serves as an account picker. When advanced search form is called that way, some fields dont have any effect on the results (are ignored). 4 of 20 fields are affected. My guess is they are all custom.
Analyzing the output ive figured out that the generated input elements which serve the affected fields are missing the name and id attributes (empty: name="" id=""). So im not surprised that those inputs are not being processed by the search query since there is no value in post. Using the searchform directly (not in popup) doesnt show this behaviour.
So my guess is, those arguments are going lost somewhere, but only when the search mask is called through a popup. Ive been searching these forums but couldnt find anything helpfull sofar. I have full access to the code and the database (mysql) and of course, ive made myself an admin account on local test mirrow.
At first ive tried to clean up everything using the quick fix and rebuild feature. After that ive republished all the layouts to regenerate the templates and vardefs. It didnt help.
Further ive found out odd things related to these fields. Lets take one of them as example (postal code) .
I know there are default fields billing_adress_postalcode and shipping_adress_postalcode. None of them being used for some reason. Instead a field named adress_postalcode is used, which seems to be custom, but im not sure yet. Default fields are available, just not used in any way. Maybe someone has put a wrong field somewhere. Im just about to find out more about this right now. On the other hand, the search form is working when called directly. Its just broken when it is used to find another account for association.
I took a look into the code and found something of interest.
1. In modules\accounts\metadata\popupdefs.php i cannot find listing for that field. The default fields shipping_adress_postalcode and billing_adress_postalcode are present though. Actualy no custom fields are listed there at all even though some are working. Not sure what that file is good for, but it looks like it handles the parameter passing to the forms when they are called in a popup, therefore i took a look inside. Correct me if im wrong.
2. in cache\modules\accounts\accountvardefs.php i can see all the fields including the custom ones, all but not those that are affected. Field entries for the broken fields are missing. That looks like a promising hook.
3. in cache\modules\accounts\detailview.tpl (template for detailed view which accesses postalcode, and works correctly) is no entry named "adress_postalcode" instead i found this:
So there is a default field being processed istead the custom one. There is only one field which shows postalcode and it seems to be the default one.Code:{capture name="label" assign="label"} {sugar_translate label='LBL_BILLING_ADDRESS_POSTALCODE' module='Accounts'} {/capture} {$label|strip_semicolon}: </td> <td width='37.5%' class='tabDetailViewDF' > {counter name="panelFieldCount"} {$fields.billing_address_postalcode.value}
All this might confirm that different fields are used for the same issue. But why the hell is this still working when called directly?
In cache\modules\accounts\searchform_advanced.tpl which is a template for advanced search i found the following:
This looks like the place where those attributes are written into html output. So at this point in $fields.adress_postalcode_advanced.name is expected to contain the name of the element which is not present for some reason when called via popup. Default postalcode fields are not listed at all in that file.Code:{if empty($fields.address_postalcode_advanced.value) && $fields.address_postalcode_advanced.value != '0' } {assign var="value" value=$fields.address_postalcode_advanced.default_value } {else} {assign var="value" value=$fields.address_postalcode_advanced.value } {/if} {assign var="type" value=$fields.address_postalcode_advanced.type } {assign var="ext2" value=$fields.address_postalcode_advanced.ext2 } {assign var="searchOptionId" value="src_"|cat:$fields.address_postalcode_advanced.name } <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> <input type='text' name='{$fields.address_postalcode_advanced.name}' id='{$fields.address_postalcode_advanced.name}' size='30' value='{$value}' tabindex='' > </td> <td> <span id="adspan_{$searchOptionId}" style="padding-left:2px; cursor:pointer;" onClick="popupSearchOptions('{$searchOptionId}', this);"><img border="0" src="{$IMG_PATH}MoreDetail.png" width="8" height="7"></span> </td> <td> <span id="adasterisk_{$searchOptionId}" style="display:none; padding-left:5px;">*</span> </td> </tr> </table>
Im pretty much confused and stuck with all this and running out of ideas. Now im gonna get myself a cofee and see if i can find out more. Hope some of you have any ideas that didnt cross my mind yet.
Thanking in anticipation.


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks