fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6812] property: mandatory fields in projects


From: Sigurd Nes
Subject: [Fmsystem-commits] [6812] property: mandatory fields in projects
Date: Thu, 20 Jan 2011 15:17:34 +0000

Revision: 6812
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6812
Author:   sigurdne
Date:     2011-01-20 15:17:33 +0000 (Thu, 20 Jan 2011)
Log Message:
-----------
property: mandatory fields in projects

Modified Paths:
--------------
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.solookup.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2011-01-19 13:33:11 UTC (rev 
6811)
+++ trunk/property/inc/class.sogeneric.inc.php  2011-01-20 15:17:33 UTC (rev 
6812)
@@ -928,6 +928,7 @@
                                        );
                                break;
                        case 'b_account':
+                       case 'b_account_category':
                                $info = array
                                        (
                                                'table' => 
'fm_b_account_category',
@@ -939,11 +940,24 @@
                                                                'name' => 
'descr',
                                                                'descr' => 
lang('descr'),
                                                                'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'project_group',
+                                                               'descr' => 
lang('mandatory project group'),
+                                                               'type' => 
'checkbox'
                                                        )
                                                ),
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
-                                               'name'          => lang('budget 
account'),
+                                               'name'          => lang('budget 
account group'),
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::accounting_cats'
                                        );

Modified: trunk/property/inc/class.solookup.inc.php
===================================================================
--- trunk/property/inc/class.solookup.inc.php   2011-01-19 13:33:11 UTC (rev 
6811)
+++ trunk/property/inc/class.solookup.inc.php   2011-01-20 15:17:33 UTC (rev 
6812)
@@ -186,6 +186,8 @@
                        $role           = isset($data['role'])?$data['role']:'';
                        $parent         = isset($data['parent']) && 
$data['parent'] ? (int)$data['parent'] : 0;
 
+                       $join = '';
+                       $filter_parent = '';
                        if($role == 'group')
                        {
                                $table = 'fm_b_account_category';
@@ -193,27 +195,21 @@
                        else
                        {
                                $table = 'fm_b_account';
+                               $join = " {$this->join} fm_b_account_category 
ON (fm_b_account.category = fm_b_account_category.id AND 
fm_b_account_category.active = 1)";
                        }
 
                        if ($order)
                        {
-                               $ordermethod = " ORDER BY $order $sort";
+                               $ordermethod = " ORDER BY {$table}.{$order} 
$sort";
                        }
                        else
                        {
-                               $ordermethod = ' ORDER BY id DESC';
+                               $ordermethod = " ORDER BY {$table}.id DESC";
                        }
 
-                       $where = 'WHERE';
+                       $filtermethod = " WHERE {$table}.active = 1";
+                       $where = 'AND';
 
-                       $filtermethod = '';
-
-                       if($role != 'group')
-                       {
-                               $filtermethod .= " {$where} active = 1";
-                               $where = 'AND';
-                       }
-
                        if($parent)
                        {
                                $filtermethod .= " {$where} category = 
{$parent}";
@@ -234,7 +230,7 @@
                                }
                        }
 
-                       $sql = "SELECT * FROM 
{$table}{$filtermethod}{$querymethod}";
+                       $sql = "SELECT {$table}.* FROM 
{$table}{$join}{$filtermethod}{$querymethod}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
@@ -252,10 +248,10 @@
                        while ($this->db->next_record())
                        {
                                $b_account[] = array
-                                       (
-                                               'id'                    => 
$this->db->f('id'),
-                                               'descr'                 => 
$this->db->f('descr',true)
-                                       );
+                               (
+                                       'id'                    => 
$this->db->f('id'),
+                                       'descr'                 => 
$this->db->f('descr',true)
+                               );
                        }
 
                        return $b_account;

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2011-01-19 13:33:11 UTC (rev 
6811)
+++ trunk/property/inc/class.uiproject.inc.php  2011-01-20 15:17:33 UTC (rev 
6812)
@@ -1071,6 +1071,27 @@
                                        $error_id=true;
                                }
 
+                               if(!isset($values['b_account_id']) || 
!$values['b_account_id'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select an account group!'));
+                                       $error_id=true;
+                               }
+                               else
+                               {
+                                       $sogeneric              = 
CreateObject('property.sogeneric');
+                                       
$sogeneric->get_location_info('b_account_category',false);
+                                       $status_data    = 
$sogeneric->read_single(array('id' => (int)$values['b_account_id']),array());
+
+                                       if(isset($status_data['project_group']) 
&& $status_data['project_group'])//mandatory for this account group
+                                       {
+                                               
if(!isset($values['project_group']) || !$values['project_group'])
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please select a project group!'));
+                                                       $error_id=true;
+                                               }
+                                       }
+                               }
+
                                if(!isset($values['end_date']) || 
!$values['end_date'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select an end date!'));

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2011-01-19 13:33:11 UTC (rev 6811)
+++ trunk/property/setup/phpgw_no.lang  2011-01-20 15:17:33 UTC (rev 6812)
@@ -1233,7 +1233,7 @@
 project categories     property        no      Prosjekt kategorier
 project coordinator    property        no      Prosjekt ansvarlig
 project end date       property        no      Prosjekt sluttdato
-project group  property        no      Prosjekt gruppe
+project group  property        no      Agresso prosjekt
 project id     property        no      Prosjekt ID
 project info   property        no      Prosjekt info.
 project name   property        no      Prosjekt navn

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2011-01-19 13:33:11 UTC (rev 6811)
+++ trunk/property/setup/setup.inc.php  2011-01-20 15:17:33 UTC (rev 6812)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.606';
+       $setup_info['property']['version']              = '0.9.17.607';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2011-01-19 13:33:11 UTC (rev 
6811)
+++ trunk/property/setup/tables_current.inc.php 2011-01-20 15:17:33 UTC (rev 
6812)
@@ -468,7 +468,9 @@
                'fm_b_account_category' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
-                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False)
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'active' => array('type' => 'int','precision' 
=> '2','nullable' => True,'default' => '0'),
+                               'project_group' => array('type' => 
'int','precision' => '2','nullable' => True,'default' => '0')
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2011-01-19 13:33:11 UTC (rev 
6811)
+++ trunk/property/setup/tables_update.inc.php  2011-01-20 15:17:33 UTC (rev 
6812)
@@ -4975,3 +4975,28 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+       
+
+       /**
+       * Update property version from 0.9.17.606 to 0.9.17.607
+       * Add authorities demands type to request
+       * 
+       */
+
+       $test[] = '0.9.17.606';
+       function property_upgrade0_9_17_606()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_b_account_category','active', 
array('type' => 'int','precision' => '2','nullable' => True,'default' => '0')); 
                            
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_b_account_category','project_group',
 array('type' => 'int','precision' => '2','nullable' => True,'default' => 
'0'));                              
+               $GLOBALS['phpgw_setup']->oProc->query('UPDATE 
fm_b_account_category SET active = 1',__LINE__,__FILE__);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.607';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]