asterisk2billing.org
http://forum.asterisk2billing.org/

FormHandler question
http://forum.asterisk2billing.org/viewtopic.php?f=18&t=3937
Page 1 of 1

Author:  percivi [ Tue Jul 08, 2008 10:16 pm ]
Post subject:  FormHandler question

I've searched about everywhere I can think of and I can't seem to find the answer.

In the FormHandler class under function AddEditElement(), is there a more detailed usage format for field 15 (SQL CUSTOM QUERY)? I would like to figure out how to have a form update a custom table not matching the associated A2B_entity. From what I can gather, this would be done using the SQL CUSTOM QUERY field, but I cannot find a defined format for this query. It does not appear to be standard SQL from what I've seen in other entities that use it.

The only info I see is in {Trunk}/A2Billing_UI/lib/Form/Class.FormHandler.inc.php:801 as follows:
Code:
        // 15. SQL CUSTOM QUERY : customer SQL   or   function to display the edit input

Any input would be much appreciated!

Thanks.

Author:  asiby [ Wed Jul 09, 2008 4:45 pm ]
Post subject: 

Hello Percivi,

What form are you trying to customize? It might be better for you to redo the form using conventional means and handle the form processing yourself. I would be really surprise if the FormHandler let you easily do what you are trying to do.

Cheers

Author:  percivi [ Wed Jul 09, 2008 7:34 pm ]
Post subject: 

Thanks for the response.

I am adding an AddEditElement to the FG_var_card.inc file, and that works fine. However, I want this one html field to update a database field for a separate table from 'cc_card'. For example, an AddEditElement that inserts its input value into 'customfield' of the 'cc_custom' table versus inserting it into 'definedfield' of the 'cc_card' table.

This way when someone creates a new customer using the create customer page, they are presented a new option that puts its value in a separate table from 'cc_card'. It would appear that this is already being done in this same form for the CALLERID field, but I cannot figure out the format of the php function parameter.

The code for the CALLERID field is as follows:
Code:
$HD_Form -> AddEditElement (gettext("CALLERID"),
                           "callerid",
                           '$value',
                           "INSERT",
                           "",
                           "",
                           "",
                           "sql",
                           "call_tariff",
                           "label, id",
                           "", "", "%1 : (%2)", "", "", "cc_callerid:cid:cc_callerid:cid, cid, id_cc_card:id_cc_card = %id:id_cc_card:%3 - (%1)::othertablelinked:cli, id_cc_card:%1:id_cc_card='%1':18");
As you can see, it's updating the 'cc_callerid' table instead of the 'cc_card' table. This is exactly what I want to do but for a different table.

Thanks in advance for any help :)

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/