Hi
This is my first Forum post, so just to set the scene I'm new to developing/customising Sugar, but have a background in developing in PHP, MySQL, Smarty, etc. However my biggest problem is working out how Sugar 'hangs together'
I've got what is hopefully a simple question. I'm building a customisation to our Quotes module, which in esscence is a new button in the DetailView that when clicked will export the current record to Excel. I have a class that handles all the Excel export stuff (ExcelExport.php) and a script that implements this for the Quotes module (ExportToExcel.php). I've placed these in the ...custom/modules/Quotes folder.
I've added a button to the ...custom/modules/Quotes/metadata/detailview.php which nicely displays the button (getting the module level labels to display gave me a bit of a headach, but I've sorted that!).
However, my problem, or more likely it's just a lack of understanding is getting the button to run the script (and maintain security etc)
I've tried several ways to get the button to work, mainly variations on:
which gives me a (badly formated - my code!) XLS with the contaiing the Quotes DetailView page with the data generated by my code kind of stuck in the middle or:Code:array ( 'customCode' => '<form action="index.php" method="POST" name="XLSExport" id="form"> <input type="hidden" name="module" value="Quotes"> <input type="hidden" name="record" value="{$fields.id.value}"> <input type="hidden" name="action" value="ExportToExcel"> <input title="{$MOD.LBL_EXCEL_BUTTON_TITLE}" accessKey="{$MOD.LBL_EXCEL_BUTTON_KEY}" class="button" type="submit" name="button" value="{$MOD.LBL_EXCEL_BUTTON_LABEL}"> </form>'
which tries to open the script directly and (correctly) tells me it isn't a vaild entry point (standard check in the first line of the script).Code:array ( 'customCode' => '<form action="./custom/modules/Quotes/ExportToExcel.php" method="POST" name="XLSExport" id="form"> <input type="hidden" name="module" value="Quotes"> <input type="hidden" name="record" value="{$fields.id.value}"> <input title="{$MOD.LBL_EXCEL_BUTTON_TITLE}" accessKey="{$MOD.LBL_EXCEL_BUTTON_KEY}" class="button" type="submit" name="button" value="{$MOD.LBL_EXCEL_BUTTON_LABEL}"> </form>'
I'm sure that both these approaches are spectatually dumb, but I'm just trying to get a handle on Sugar customisation.
Any help would be appreciated.
Thanks
Steve


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks