Author Topic: Database error when accessing weblinks tab as administrator.  (Read 6756 times)

Friso

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Hello Ignacio and all the team at opengoo!
I get a database error message when accessing the web link page. this happens only when I log in as administrator. When I use a normal account i.e. an account my collegues use I can see the page wuith out any probelms.
The version is 1.3.1.

The error states that:
Query failed with message 'Unknown column 'name' in 'order clause''

These are the details:

Error params:
File:    D:\xampp\htdocs\opengoo\environment\library\database\adapters\AbstractDBAdapter.class.php
Line:    386
Sql:    SELECT * FROM `project_webpages` WHERE `trashed_by_id` = 0 AND (`trashed_by_id` = 0 AND ( '1' = '1' AND ( ( ( `created_by_id` = 1) OR ( project_webpages.`project_id` = (SELECT `personal_project_id` FROM `users` `xx_u` WHERE `xx_u`.`id` = 1)) OR ( EXISTS ( SELECT * FROM `project_users` `xx_pu` WHERE `xx_pu`.`user_id` IN (1,10000000) AND `xx_pu`.`project_id` = project_webpages.`project_id` AND `xx_pu`.can_read_weblinks = true ) ) ) ) AND `project_id` IN (19, 2, 17, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36) )) ORDER BY `name` ASC LIMIT 0, 50
Error number:    1054
Error message:    Unknown column 'name' in 'order clause'
Backtrace:
#0 D:\xampp\htdocs\opengoo\environment\library\database\adapters\AbstractDBAdapter.class.php(304): AbstractDBAdapter->prepareAndExecute('SELECT * FROM `...', NULL)
#1 D:\xampp\htdocs\opengoo\environment\library\database\DB.class.php(199): AbstractDBAdapter->executeAll('SELECT * FROM `...', NULL)
#2 D:\xampp\htdocs\opengoo\environment\classes\dataaccess\DataManager.class.php(182): DB::executeAll('SELECT * FROM `...')
#3 D:\xampp\htdocs\opengoo\application\models\ProjectDataObjects.class.php(31): DataManager->find(Array)
#4 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(115): ProjectDataObjects->find(Array)
#5 D:\xampp\htdocs\opengoo\environment\classes\dataaccess\DataManager.class.php(210): BaseProjectWebpages->find(Array)
#6 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(132): DataManager->findAll(Array)
#7 D:\xampp\htdocs\opengoo\environment\classes\dataaccess\DataManager.class.php(296): BaseProjectWebpages->findAll(Array)
#8 D:\xampp\htdocs\opengoo\application\models\ProjectDataObjects.class.php(36): DataManager->paginate(Array, 50, 1)
#9 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(225): ProjectDataObjects->paginate(Array, 50, 1)
#10 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(227): BaseProjectWebpages->paginate(Array, 50, 1)
#11 D:\xampp\htdocs\opengoo\application\models\project_webpages\ProjectWebpages.class.php(49): BaseProjectWebpages->paginate(Array, 50, 1)
#12 D:\xampp\htdocs\opengoo\application\controllers\WebpageController.class.php(296): ProjectWebpages->getWebpages('19, 2, 17, 20, ...', '', 1, '50', 'name', 'ASC')
#13 D:\xampp\htdocs\opengoo\environment\classes\controller\Controller.class.php(75): WebpageController->list_all()
#14 D:\xampp\htdocs\opengoo\environment\classes\controller\PageController.class.php(62): Controller->execute('list_all')
#15 D:\xampp\htdocs\opengoo\environment\classes\Env.class.php(133): PageController->execute('list_all')
#16 D:\xampp\htdocs\opengoo\init.php(146): Env::executeAction('webpage', 'list_all')
#17 D:\xampp\htdocs\opengoo\index.php(9): require('D:\xampp\htdocs...')
#18 {main}
Autoglobal varibles:
$_GET:    Array (
  ['active_project'] => (string) '19'
  ['ajax'] => (string) 'true'
  ['c'] => (string) 'webpage'
  ['a'] => (string) 'list_all'
  ['start'] => (string) '0'
  ['limit'] => (string) '50'
  ['tag'] => (string) ''
  ['sort'] => (string) 'name'
  ['dir'] => (string) 'ASC'
  ['current'] => (string) 'webpages-panel'
  ['_dc'] => (string) '1242292117633'
)
$_POST:    
$_COOKIE:    Array (
  ['guiwiki_session'] => (string) '16502fa40aedfb4937a51e64742136a4'
  ['PHPSESSID'] => (string) '69dbc0c3bb473732ddcdfe3fb3720ee3'
  ['id'] => (string) '1'
  ['token'] => (string) 'daaeb682e4b16c99063c612c322a129dbe4f73cf'
)
$_SESSION:    Array (
  ['cal_version'] => true
  ['month'] => (string) '5'
  ['year'] => (string) '2009'
  ['day'] => (string) '13'
  ['cal_loginfailed'] => (int)0
  ['cal_user'] => (string) 'Friso Dijkgraaf'
  ['cal_userid'] => (int)1
)
Execution time:
Total execution time: 0.344813 seconds


Hope you can help me..
Thanks,
Friso
Friso

alvarotm01

  • Administrator
  • Sr. Member
  • *****
  • Posts: 335
    • View Profile
    • Email
Re: Database error when accessing weblinks tab as administrator.
« Reply #1 on: May 14, 2009, 10:22:28 am »
Hi,
Take a look at the code at "public/assets/javascript/og/WebpageManager.js" line 116, ensure that you have exactly this:
   sm,{
      id: 'title',
      header: lang("title"),
      dataIndex: 'title',
      width: 120,
      sortable: true,
      renderer: renderName
        }

if this is ok, then to fix this you may edit "application/controllers/WebpageController.php" and after line 229, add this line:
if ($order == "name") $order = "title";

this should work fine.

Friso

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Database error when accessing weblinks tab as administrator.
« Reply #2 on: May 14, 2009, 10:32:01 am »
Thanks for the fix alvarotm01!
Changing if ($order == "updatedOn" || $order == "updated") $order = "updated_on"; to if ($order == "name") $order = "title"; solved my problem. ;D

Have a good day,
Friso
Friso

Friso

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Database error when accessing weblinks tab as administrator.
« Reply #3 on: May 14, 2009, 10:46:24 am »
I guess I raised the victory flag too soon.. ::)
Now it's the other way round. When I log as administrator I can see the weblinks while I get the same error when logging in with an unpriviledged user account..
The same issue is described in this topic: http://forums.opengoo.org/index.php?topic=1334.0

Error (DBQueryError)
Query failed with message 'Unknown column 'updated' in 'order clause''
Error params:
File:    D:\xampp\htdocs\opengoo\environment\library\database\adapters\AbstractDBAdapter.class.php
Line:    386
Sql:    SELECT * FROM `project_webpages` WHERE `trashed_by_id` = 0 AND (`trashed_by_id` = 0 AND ( '1' = '1' AND ( ( ( `created_by_id` = 3) OR ( project_webpages.`project_id` = (SELECT `personal_project_id` FROM `users` `xx_u` WHERE `xx_u`.`id` = 3)) OR ( EXISTS ( SELECT * FROM `project_users` `xx_pu` WHERE `xx_pu`.`user_id` IN (3,10000000) AND `xx_pu`.`project_id` = project_webpages.`project_id` AND `xx_pu`.can_read_weblinks = true ) ) ) ) AND `project_id` IN (29,19,27,24,17,2,36,30,4,31,32,35,20,22,21,33,25,26,23,13) )) ORDER BY `updated` DESC LIMIT 0, 50
Error number:    1054
Error message:    Unknown column 'updated' in 'order clause'
Backtrace:
#0 D:\xampp\htdocs\opengoo\environment\library\database\adapters\AbstractDBAdapter.class.php(304): AbstractDBAdapter->prepareAndExecute('SELECT * FROM `...', NULL)
#1 D:\xampp\htdocs\opengoo\environment\library\database\DB.class.php(199): AbstractDBAdapter->executeAll('SELECT * FROM `...', NULL)
#2 D:\xampp\htdocs\opengoo\environment\classes\dataaccess\DataManager.class.php(182): DB::executeAll('SELECT * FROM `...')
#3 D:\xampp\htdocs\opengoo\application\models\ProjectDataObjects.class.php(31): DataManager->find(Array)
#4 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(115): ProjectDataObjects->find(Array)
#5 D:\xampp\htdocs\opengoo\environment\classes\dataaccess\DataManager.class.php(210): BaseProjectWebpages->find(Array)
#6 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(132): DataManager->findAll(Array)
#7 D:\xampp\htdocs\opengoo\environment\classes\dataaccess\DataManager.class.php(296): BaseProjectWebpages->findAll(Array)
#8 D:\xampp\htdocs\opengoo\application\models\ProjectDataObjects.class.php(36): DataManager->paginate(Array, 50, 1)
#9 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(225): ProjectDataObjects->paginate(Array, 50, 1)
#10 D:\xampp\htdocs\opengoo\application\models\project_webpages\base\BaseProjectWebpages.class.php(227): BaseProjectWebpages->paginate(Array, 50, 1)
#11 D:\xampp\htdocs\opengoo\application\models\project_webpages\ProjectWebpages.class.php(49): BaseProjectWebpages->paginate(Array, 50, 1)
#12 D:\xampp\htdocs\opengoo\application\controllers\WebpageController.class.php(296): ProjectWebpages->getWebpages('29,19,27,24,17,...', '', 1, '50', 'updated', 'DESC')
#13 D:\xampp\htdocs\opengoo\environment\classes\controller\Controller.class.php(75): WebpageController->list_all()
#14 D:\xampp\htdocs\opengoo\environment\classes\controller\PageController.class.php(62): Controller->execute('list_all')
#15 D:\xampp\htdocs\opengoo\environment\classes\Env.class.php(133): PageController->execute('list_all')
#16 D:\xampp\htdocs\opengoo\init.php(146): Env::executeAction('webpage', 'list_all')
#17 D:\xampp\htdocs\opengoo\index.php(9): require('D:\xampp\htdocs...')
#18 {main}
Autoglobal varibles:
$_GET:    Array (
  ['active_project'] => (string) '0'
  ['ajax'] => (string) 'true'
  ['c'] => (string) 'webpage'
  ['a'] => (string) 'list_all'
  ['start'] => (string) '0'
  ['limit'] => (string) '50'
  ['tag'] => (string) ''
  ['sort'] => (string) 'updated'
  ['dir'] => (string) 'DESC'
  ['current'] => (string) 'webpages-panel'
  ['_dc'] => (string) '1242308384532'
)
$_POST:    
$_COOKIE:    Array (
  ['PHPSESSID'] => (string) 'f9f434216b41168635e3e69efc65536d'
  ['id'] => (string) '3'
  ['token'] => (string) '078fac13cb753a90fdff41f4f27e8d0e7199bad7'
)
$_SESSION:    Array (
  ['cal_version'] => true
  ['month'] => (string) '5'
  ['year'] => (string) '2009'
  ['day'] => (string) '14'
)
Execution time:
Total execution time: 0.332112 seconds
Friso

alvarotm01

  • Administrator
  • Sr. Member
  • *****
  • Posts: 335
    • View Profile
    • Email
Re: Database error when accessing weblinks tab as administrator.
« Reply #4 on: May 14, 2009, 10:59:45 am »
Friso,

I didn't mean to overwrite that line, only add that line after the one which is there.
It must look like this:

$order = array_var($_GET, 'sort');
if ($order == "name") $order = "title";
if ($order == "updatedOn" || $order == "updated") $order = "updated_on";

greetings

Friso

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Database error when accessing weblinks tab as administrator.
« Reply #5 on: May 14, 2009, 11:03:23 am »
You are right, I didn't read your message as carefully as I should have..
It works ok now.

Sorry for the fuss I made.
Thanks again!

Friso

alvarotm01

  • Administrator
  • Sr. Member
  • *****
  • Posts: 335
    • View Profile
    • Email
Re: Database error when accessing weblinks tab as administrator.
« Reply #6 on: May 14, 2009, 11:58:38 am »
no problem !!
i'm glad you could solve it.

greetings !