Author Topic: adding fields in table, applying in controller  (Read 2414 times)

ras2000

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Proremus
adding fields in table, applying in controller
« on: April 21, 2009, 09:38:42 am »
Hello all
I was looking at
http://forums.opengoo.org/index.php?topic=1494.0
and thought I'd give it a try

I added a column to og_billing_categories called default_currency

I added the fields in add.php and index.php

I added the functions inBaseBillingCategory.class.php and the parameter in BillingController.class.php.

But the field is not updated in the table, and if I enter the currency manually, it does not appear on the pages.

Anyone know what I'm doing wrong?

I added the functions
    function getDefaultCurrency() {
      return $this->getColumnValue('default_currency');
    } // getDefaultCurrency()
    function setDefaultCurrency($value) {
      return $this->setColumnValue('default_currency', $value);
    } // setDefaultCurrency)
in BaseBillingCategory.class.php

I added this in BillingController.class.php, wherever relevant
            'default_currency' => '',

And changed the line where the $ was hardcoded in billing/index.php to
    <td style="text-align: center;padding:5px;padding-left:10px;padding-right:10px;"><?php echo clean($billing->getDefaultCurrency()) ?></td>
    <td style="text-align: center;padding:5px;padding-left:10px;padding-right:10px;"><?php echo clean($billing->getDefaultValue()) ?></td>

What else needs to be done for it to take effect?
If you are what you eat, then I'm fast, cheap and easy.

ras2000

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Proremus
Re: adding fields in table, applying in controller
« Reply #1 on: April 22, 2009, 05:58:53 am »
I found the missing link myself. I'll just post it, in case someone else is stumped by the same.
in BaseBillingCategories.class.php under models, the new array value needs to be designed:
    static private $columns = array(
       'id' => DATA_TYPE_INTEGER,
       'name' => DATA_TYPE_STRING,
       'default_value' => DATA_TYPE_FLOAT,
       'default_currency' => DATA_TYPE_STRING,
       'description' => DATA_TYPE_STRING,
       'report_name' => DATA_TYPE_STRING,
       'created_on' => DATA_TYPE_DATETIME,
       'created_by_id' => DATA_TYPE_INTEGER,
       'updated_on' => DATA_TYPE_DATETIME,
       'updated_by_id' => DATA_TYPE_INTEGER,
    );
If you are what you eat, then I'm fast, cheap and easy.

Pet

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Always mining for solutions!
    • View Profile
    • The Bet!
Re: adding fields in table, applying in controller
« Reply #2 on: April 22, 2009, 03:25:29 pm »
nice, thanks for posting that solution
Support OpenGoo - Sponsor a Feature! | Follow me on Twitter | OG Support Chat | Did you turn debugging on?