AnsweredAssumed Answered

Can we display html from logic hook

Question asked by sidhu sidhu on Sep 22, 2016
Latest reply on Sep 24, 2016 by Alan Apter

Hi All,

 

            Can we display html from logic hook in 7.7

 

Previously it worked in 6.5

This worked perfect for me when i had a field called amount in list view.

But not now in 7.7

 

/custom/modules/Ver/logic_hooks.php

 

$hook_array['after_ui_frame'] = Array();
$hook_array['after_ui_frame'][] = Array(1, 'Display_Sum', 'custom/modules/Ver/sum.php','SumHook', 'displayTotal');


$hook_array['process_record'] = Array();
$hook_array['process_record'][] = Array(1, 'Sum_Each', 'custom/modules/Ver/sum.php','SumHook', 'sumTotalFromEachRow');

 

 

 

 

custom/modules/Ver/sum.php

<?php
 
class SumHook
{
    protected static $sum = 0.0;
  
    function sumTotalFromEachRow(&$bean, $event, $arguments)
    {
        self::$sum += $bean->amount;
    }

    function displayTotal($event, $arguments)
    {
        if ($_REQUEST['action'] == 'index' || $_REQUEST['action'] == 'ListView')
        {
        
        self::$sum = number_format(self::$sum,2);
       
        ?>
        <span style=""><b>Total : R<?php echo self::$sum?></b></span>
        <?php
        }
    }
}
?> Tevfik Tümer Bhavesh Patel

 

Regards

Sidhu

Outcomes