Fixed error, CompanyCategory index web page.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 11 Dec 2012 02:40:04 +0000 (03:40 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 11 Dec 2012 02:40:04 +0000 (03:40 +0100)
apps/companyfront/modules/category/templates/_list.php
lib/model/doctrine/CompanyCategoryTable.class.php

index a54fef0..59e05c8 100644 (file)
@@ -34,7 +34,7 @@
         <?php endif; ?>
       </td>
       <td>
-        <?php if ($company_category->getId() != 1): ?>
+        <?php if ($company_category->getLevel() != 0): ?>
          <a href="<?php echo url_for('category/edit?id='.$company_category->getId()) ?>">
          <img src="/images/pencil_add.png" alt="" title="" border="0" /></a>
         <?php else: ?>
@@ -42,7 +42,7 @@
         <?php endif; ?>
       </td>
       <td>
-        <?php if ($company_category->getId() != 1): ?>   
+        <?php if ($company_category->getLevel() != 0): ?>
          <?php echo link_to('<img src="/images/inadminpanel/images/trash.png" alt="" title="" border="0" />', 'category/delete?id='.$company_category->getId(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?>
         <?php else: ?>
          <a><img src="/images/cross.png" alt="" title="" border="0" /></a>
index ca668d9..69c4b1d 100644 (file)
@@ -29,13 +29,13 @@ class CompanyCategoryTable extends Doctrine_Table
         {
             return $this->createQuery('cc')->where('cc.company_id = ?', $companyId)
                                            ->andWhere('cc.id != ?', $currentCategory)
-                                           ->orWhere('cc.id = ?', '1')
+                                           ->orWhere('cc.level = ?', '0')
                                            ->orderBy('cc.lft');
         }
         else
         {
             return $this->createQuery('cc')->where('cc.company_id = ?', $companyId)
-                                           ->orWhere('cc.id = ?', '1')
+                                           ->orWhere('cc.level = ?', '0')
                                            ->orderBy('cc.lft');
         }
     }