tablename_init() hook

Discussions related to customizing hooks. Hooks are documented at
Post Reply
Posts: 1
Joined: 2013-06-19 09:32

tablename_init() hook

Post by frankotse » 2013-06-27 14:26

appGiniForum.jpg (151.54 KiB) Viewed 2532 times
Is it possible to use tablename_init() hook to update data.

EstimateItem is child table of Product and EstimateForm
When update Product.price will use below script to update EstimateItem contains updated Product.

function Product_after_update($data, $memberInfo, &$args){

// update item price
$price=sqlValue("select Product.price from Product where id='$product_price'");
sql("update EstimateItem set total='$price'*qty where EstimateItem.price='$product_price'", $eo);

return TRUE;

I use below script to update EstimateForm contains updated EstimateItem.

function EstimateForm_after_update($data, $memberInfo, &$args){
return TRUE;

function updateEstimateTotals($estimate_codeID){
// update EstimateForm estimate_total, other_total and total
$total1=sqlValue("select sum(total) from EstimateItem where estimate_code='$estimate_codeID'");
$total2=sqlValue("select sum(total) from OtherItem where estimate_code='$estimate_codeID'");
$total=$total1 + $total2;
sql("update EstimateForm set estimate_total='$total1' where id='$estimate_codeID'", $eo);
sql("update EstimateForm set other_total='$total2' where id='$estimate_codeID'", $eo);
sql("update EstimateForm set total='$total' where id='$estimate_codeID'", $eo);
Problem is that EstimateForm contains updated EstimateItem does not update when directly open it or by link from EstimateItem.

I use below script but not worked.

function EstimateForm_init(&$options, $memberInfo, &$args){

return TRUE;

Veteran Member
Posts: 204
Joined: 2013-04-09 19:29

Re: tablename_init() hook

Post by toconnell » 2013-07-02 19:18

I am sorry I can not help with this.. but would love to know how you got your arrows for previous and next to appear together at the bottom custom like that?

Your advise would be appreciated.

Thank you,

Post Reply