Author Topic: I can't stop work on the task  (Read 8313 times)

woland255

  • Freshman
  • *
  • Posts: 39
    • View Profile
I can't stop work on the task
« on: March 12, 2009, 11:39:06 am »
It seems that someone forgot billing ID parameter
Next message appears:

Error (DBQueryError)
Query failed with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1'
Error params:
File:    /var/www/apache2/html/opengoo/environment/library/database/adapters/AbstractDBAdapter.class.php
Line:    386
Sql:    SELECT * FROM `og_workspace_billings` WHERE project_id = 12 AND billing_id =
Error number:    1064
Error message:    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Backtrace:
#0 /var/www/apache2/html/opengoo/environment/library/database/adapters/AbstractDBAdapter.class.php(304): AbstractDBAdapter->prepareAndExecute('SELECT * FROM `...', NULL)
#1 /var/www/apache2/html/opengoo/environment/library/database/DB.class.php(199): AbstractDBAdapter->executeAll('SELECT * FROM `...', NULL)
#2 /var/www/apache2/html/opengoo/environment/classes/dataaccess/DataManager.class.php(182): DB::executeAll('SELECT * FROM `...')
#3 /var/www/apache2/html/opengoo/application/models/workspace_billing/base/BaseWorkspaceBillings.class.php(111): DataManager->find(Array)
#4 /var/www/apache2/html/opengoo/environment/classes/dataaccess/DataManager.class.php(228): BaseWorkspaceBillings->find(Array)
#5 /var/www/apache2/html/opengoo/application/models/workspace_billing/base/BaseWorkspaceBillings.class.php(145): DataManager->findOne(Array)
#6 /var/www/apache2/html/opengoo/application/models/workspace_billing/base/BaseWorkspaceBillings.class.php(147): BaseWorkspaceBillings->findOne(Array)
#7 /var/www/apache2/html/opengoo/application/models/projects/Project.class.php(448): BaseWorkspaceBillings->findOne(Array)
#8 /var/www/apache2/html/opengoo/application/controllers/TimeslotController.class.php(164): Project->getBillingAmount(NULL)
#9 /var/www/apache2/html/opengoo/environment/classes/controller/Controller.class.php(69): TimeslotController->close()
#10 /var/www/apache2/html/opengoo/environment/classes/controller/PageController.class.php(62): Controller->execute('close')
#11 /var/www/apache2/html/opengoo/environment/classes/Env.class.php(133): PageController->execute('close')
#12 /var/www/apache2/html/opengoo/init.php(146): Env::executeAction('timeslot', 'close')
#13 /var/www/apache2/html/opengoo/index.php(9): require('/var/www/apache...')
#14 {main}
Autoglobal varibles:
$_GET:    Array (
  ['active_project'] => (string) '16'
  ['ajax'] => (string) 'true'
  ['c'] => (string) 'timeslot'
  ['a'] => (string) 'close'
  ['id'] => (string) '122'
  ['current'] => (string) 'overview-panel'
)
$_POST:    Array (
  ['timeslot'] => Array (
    ['description'] => (string) ''
  )
)
$_COOKIE:    Array (
  ['id'] => (string) '2'
  ['token'] => (string) '313d31b228db542105278d0374e449b52185626f'
  ['PHPSESSID'] => (string) 'vpi7obkedp986ecb8vtbjusbmqgapt58'
)
$_SESSION:    Array (
  ['cal_version'] => true
  ['month'] => (string) '3'
  ['year'] => (string) '2009'
  ['day'] => (string) '12'
)
Execution time:
Total execution time: 0.218347 seconds
« Last Edit: March 13, 2009, 04:43:50 am by woland255 »

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: I can't stop work on the task
« Reply #1 on: March 13, 2009, 02:19:38 pm »
I couldn't reproduce the error message on my installation, but this will be corrected on the final version anyway. The problem lies in that the default billing category id for users has been set to NULL instead of 0.

For a quick fix try adding this on 'application/models/projects/Project.class.php' before line 448, after 'function getBillingAmount...':
Code: [Select]
if (!is_numeric($billing_category_id)) $billing_category_id = 0;

woland255

  • Freshman
  • *
  • Posts: 39
    • View Profile
Re: I can't stop work on the task
« Reply #2 on: March 16, 2009, 05:34:36 am »
Thanks, this works

mrova

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: I can't stop work on the task
« Reply #3 on: March 25, 2009, 02:28:54 pm »
That is not a solution!

in file application/models/projects/Project.class.php on line 451 in SQL condition the ? sign is missing:

      $wsBilling = WorkspaceBillings::findOne(
         array('conditions' => array(
            'project_id = ? AND billing_id = ',
            $this->getId(),
            $billing_category_id
         ))
      );

And should be like that:

      $wsBilling = WorkspaceBillings::findOne(
         array('conditions' => array(
            'project_id = ? AND billing_id = ?',
            $this->getId(),
            $billing_category_id
         ))
      );
   

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: I can't stop work on the task
« Reply #4 on: March 25, 2009, 07:24:22 pm »
Actually, that was the solution at that moment :D. The bug you are correcting was introduced later  :-[

http://forums.opengoo.org/index.php?topic=1269.msg4976#msg4976

mrova

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: I can't stop work on the task
« Reply #5 on: March 25, 2009, 09:25:07 pm »
ok, i got it ;)
i don't know why i miss that post, sorry.