fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10425]


From: Torstein
Subject: [Fmsystem-commits] [10425]
Date: Fri, 02 Nov 2012 09:13:14 +0000

Revision: 10425
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10425
Author:   vator
Date:     2012-11-02 09:13:14 +0000 (Fri, 02 Nov 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/logistic/inc/class.soproject.inc.php
    trunk/logistic/inc/class.uiactivity.inc.php
    trunk/logistic/inc/class.uiproject.inc.php
    trunk/logistic/inc/model/class.project.inc.php
    trunk/logistic/setup/phpgw_no.lang
    trunk/logistic/setup/setup.inc.php
    trunk/logistic/setup/tables_update.inc.php
    trunk/logistic/templates/base/project/project_item.xsl

Modified: trunk/logistic/inc/class.soproject.inc.php
===================================================================
--- trunk/logistic/inc/class.soproject.inc.php  2012-11-02 08:25:39 UTC (rev 
10424)
+++ trunk/logistic/inc/class.soproject.inc.php  2012-11-02 09:13:14 UTC (rev 
10425)
@@ -58,14 +58,32 @@
                }
 
                protected function add(&$project)
-               {
+               {               
+                       $cols = array(
+                               'name',
+                               'project_type_id',
+                               'description',
+                               'create_user',
+                               'create_date',
+                               'start_date',
+                               'end_date'
+                       );
+
                        $user_id = $GLOBALS['phpgw_info']['user']['id'];
                        $now = time();
-                       $name = $project->get_name();
-                       $description = $project->get_description();
-                       $type_id = $project->get_project_type_id();
+                       
+                       $values = array(
+                               $this->marshal($project->get_name(), 'string'),
+                               $this->marshal($project->get_project_type_id(), 
'int'),
+                               $this->marshal($project->get_description(), 
'string'),
+                               $user_id,
+                               $now,
+                               $this->marshal($project->get_start_date(), 
'int'),
+                               $this->marshal($project->get_end_date(), 'int')
+                       );
 
-                       $sql = "INSERT INTO lg_project (name, description, 
project_type_id, create_user, create_date) VALUES 
('$name','$description',$type_id, $user_id, $now)";
+                       $sql = 'INSERT INTO lg_project (' . join(',', $cols) . 
') VALUES (' . join(',', $values) . ')';
+
                        $result = $this->db->query($sql, __LINE__,__FILE__);
 
                        if($result)
@@ -87,7 +105,9 @@
                        $values = array(
                                'name = ' . 
$this->marshal($project->get_name(), 'string'),
                                'description = ' . 
$this->marshal($project->get_description(), 'string'),
-                               'project_type_id = ' . 
$this->marshal($project->get_project_type_id(), 'int')
+                               'project_type_id = ' . 
$this->marshal($project->get_project_type_id(), 'int'),
+                               'start_date = ' . 
$this->marshal($project->get_start_date(), 'int'),
+                               'end_date = ' . 
$this->marshal($project->get_end_date(), 'int'),
                        );
 
                        $result = $this->db->query('UPDATE lg_project SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
@@ -206,6 +226,8 @@
                                {
                                        
$project->set_project_type_label($this->get_project_type_label($this->unmarshal($this->db->f('project_type_id'),
 'int')));
                                }
+                               
$project->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
+                               
$project->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
                        }
 
                        return $project;

Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2012-11-02 08:25:39 UTC (rev 
10424)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2012-11-02 09:13:14 UTC (rev 
10425)
@@ -106,7 +106,7 @@
                                                        ),
                                                        array(
                                                                'type' => 
'link',
-                                                               'value' => 
lang('t_new_activity'),
+                                                               'value' => 
lang('Add activity'),
                                                                'href' => 
self::link(array('menuaction' => 'logistic.uiactivity.add')),
                                                                'class' => 
'new_item'
                                                        ),
@@ -117,15 +117,15 @@
                                        'source' => 
self::link(array('menuaction' => 'logistic.uiactivity.index', 'phpgw_return_as' 
=> 'json', 'filter' => phpgw::get_var('filter', 'int'))),
                                        'field' => array(
                                                array(
-                                                       'key' => 'name',
-                                                       'label' => 
lang('Activity name'),
-                                                       'sortable' => true
-                                               ),
-                                               array(
                                                        'key' => 'id',
                                                        'label' => lang('ID'),
                                                        'sortable' => true,
                                                        'formatter' => 
'YAHOO.portico.formatLink'
+                                               ),              
+                                               array(
+                                                       'key' => 'name',
+                                                       'label' => 
lang('Activity name'),
+                                                       'sortable' => true
                                                ),
                                                array(
                                                        'key' => 'project_name',

Modified: trunk/logistic/inc/class.uiproject.inc.php
===================================================================
--- trunk/logistic/inc/class.uiproject.inc.php  2012-11-02 08:25:39 UTC (rev 
10424)
+++ trunk/logistic/inc/class.uiproject.inc.php  2012-11-02 09:13:14 UTC (rev 
10425)
@@ -38,16 +38,16 @@
 
                private $so;
                public $public_functions = array(
-                       'query' => true,
-                       'index' => true,
-                       'project_types' => true,
-                       'view' => true,
-                       'view_project_type' => true,
-                       'edit_project_type' => true,
-                       'edit_project_type_name' => true,
-                       'add' => true,
-                       'edit' => true,
-                       'save' => true
+                       'query'                                                 
                        => true,
+                       'index'                                                 
                        => true,
+                       'project_types'                                         
=> true,
+                       'view'                                                  
                        => true,
+                       'view_project_type'                     => true,
+                       'edit_project_type'                     => true,
+                       'edit_project_type_name'        => true,
+                       'add'                                                   
                        => true,
+                       'edit'                                                  
                        => true,
+                       'save'                                                  
                        => true
                );
 
                public function __construct()
@@ -231,6 +231,16 @@
                                                        'sortable' => false
                                                ),
                                                array(
+                                                       'key' => 'start_date',
+                                                       'label' => lang('Start 
date'),
+                                                       'sortable' => false
+                                               ),
+                                               array(
+                                                       'key' => 'end_date',
+                                                       'label' => lang('End 
date'),
+                                                       'sortable' => false
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -514,8 +524,11 @@
 
                        $this->use_yui_editor('description');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Project type');
+                       $GLOBALS['phpgw']->jqcal->add_listener('start_date');
+                       $GLOBALS['phpgw']->jqcal->add_listener('end_date');
                        
                        phpgwapi_jquery::load_widget('core');
+                       
                        self::add_javascript('logistic', 'logistic', 
'project.js');
                        
self::render_template_xsl(array('project/project_item'), $data);
                }
@@ -534,7 +547,7 @@
                        }
                        
                        $project->populate();
-                       
+
                        if( $project->validate() )
                        {
                                $project_id = $this->so->store($project);

Modified: trunk/logistic/inc/model/class.project.inc.php
===================================================================
--- trunk/logistic/inc/model/class.project.inc.php      2012-11-02 08:25:39 UTC 
(rev 10424)
+++ trunk/logistic/inc/model/class.project.inc.php      2012-11-02 09:13:14 UTC 
(rev 10425)
@@ -38,6 +38,8 @@
                protected $project_type_id;
                protected $project_type_label;
                protected $description;
+               protected $start_date;
+               protected $end_date;
                
                protected $error_msg_array = array();
 
@@ -102,6 +104,26 @@
                        return $this->description;
                }
                
+               public function set_start_date($start_date)
+               {
+                       $this->start_date = $start_date;
+               }
+
+               public function get_start_date()
+               {
+                       return $this->start_date;
+               }
+
+               public function set_end_date($end_date)
+               {
+                       $this->end_date = $end_date;
+               }
+
+               public function get_end_date()
+               {
+                       return $this->end_date;
+               }
+               
                public function get_error_msg_array() { return 
$this->error_msg_array; }
                
                public function set_error_msg_array( $error_msg_array )
@@ -125,12 +147,16 @@
 
                public function serialize()
                {
+                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       
                        return array(
                                'id' => $this->get_id(),
                                'name' => $this->get_name(),
                                'project_type_id' => 
$this->get_project_type_id(),
                                'project_type_label' => 
$this->get_project_type_label(),
-                               'description' => $this->get_description()
+                               'description' => $this->get_description(),
+                               'start_date' => $this->get_start_date() ? 
date($date_format, $this->get_start_date()): '',
+                               'end_date' => $this->get_end_date() ? 
date($date_format, $this->get_end_date()): '',
                        );
                }
                                
@@ -139,7 +165,19 @@
                        $this->set_id( phpgw::get_var('id') );
                        $this->set_name( phpgw::get_var('name') );
                        $this->set_project_type_id( 
phpgw::get_var('project_type_id') );
-                       $this->set_description( phpgw::get_var('description') 
);                        
+                       $this->set_description( phpgw::get_var('description') );
+                       
+                       if(phpgw::get_var('start_date','string') != '')
+                       {
+                               $start_date_ts = 
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('start_date','string') );
+                               $this->set_start_date($start_date_ts);
+                       }
+                                                                               
+                       if( phpgw::get_var('end_date','string') != '')
+                       {
+                               $end_date_ts = 
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('end_date','string') );
+                               $this->set_end_date($end_date_ts);
+                       }
                }
                
                public function validate()
@@ -166,6 +204,20 @@
                        $status = false;
                        $this->error_msg_array['project_type_id'] = 
"error_msg_1";
                  }
+                 
+                  // Validate START DATE
+                       if( empty($this->start_date) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['start_date'] = "error_msg_1";
+                 }
+
+                 // Validate END DATE
+                       if( !empty($this->end_date) && ($this->end_date < 
$this->start_date) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['end_date'] = "error_msg_3";
+                 }  
        
                  return $status;
                }

Modified: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang  2012-11-02 08:25:39 UTC (rev 10424)
+++ trunk/logistic/setup/phpgw_no.lang  2012-11-02 09:13:14 UTC (rev 10425)
@@ -73,4 +73,5 @@
 Requirement allocation logistic        no      Bestilling av ressurser
 Activity details       logistic        no      Detaljer for aktivitet
 Status requirement     logistic        no      Status behov
-select logistic        no      Velg 
\ No newline at end of file
+select logistic        no      Velg
+Add project    logistic        no      Nytt prosjekt
\ No newline at end of file

Modified: trunk/logistic/setup/setup.inc.php
===================================================================
--- trunk/logistic/setup/setup.inc.php  2012-11-02 08:25:39 UTC (rev 10424)
+++ trunk/logistic/setup/setup.inc.php  2012-11-02 09:13:14 UTC (rev 10425)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['logistic']['name'] = 'logistic';
-       $setup_info['logistic']['version'] = '0.0.3';
+       $setup_info['logistic']['version'] = '0.0.4';
        $setup_info['logistic']['app_order'] = 70;
        $setup_info['logistic']['enable'] = 1;
        $setup_info['logistic']['app_group']    = 'office';

Modified: trunk/logistic/setup/tables_update.inc.php
===================================================================
--- trunk/logistic/setup/tables_update.inc.php  2012-11-02 08:25:39 UTC (rev 
10424)
+++ trunk/logistic/setup/tables_update.inc.php  2012-11-02 09:13:14 UTC (rev 
10425)
@@ -34,4 +34,28 @@
                        return $GLOBALS['setup_info']['logistic']['currentver'];
                }
        }
+       
+       $test[] = '0.0.3';
+       function logistic_upgrade0_0_3()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+       
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_project','start_date',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => true
+               ));
+               
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_project','end_date',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => true
+               ));
+       
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['logistic']['currentver'] = 
'0.0.4';
+                       return $GLOBALS['setup_info']['logistic']['currentver'];
+               }
+       }
        
\ No newline at end of file

Modified: trunk/logistic/templates/base/project/project_item.xsl
===================================================================
--- trunk/logistic/templates/base/project/project_item.xsl      2012-11-02 
08:25:39 UTC (rev 10424)
+++ trunk/logistic/templates/base/project/project_item.xsl      2012-11-02 
09:13:14 UTC (rev 10425)
@@ -2,6 +2,7 @@
 <!-- item  -->
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
+<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')"/></xsl:variable>
 
 <xsl:call-template name="yui_phpgw_i18n"/>
 <div class="yui-navset yui-navset-top">
@@ -75,6 +76,50 @@
                                                </xsl:otherwise>
                                        </xsl:choose>
                                        </dd>
+                                       <dt>
+                                               <label 
for="start_date">Startdato</label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <xsl:if 
test="project/error_msg_array/start_date != ''">
+                                                                       
<xsl:variable name="error_msg"><xsl:value-of 
select="project/error_msg_array/start_date" /></xsl:variable>
+                                                                       <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
+                                                               </xsl:if>
+                                                               <input 
class="date" id="start_date" name="start_date" type="text">
+                                                       <xsl:if 
test="project/start_date != ''">
+                                                       <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(project/start_date))"/></xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                               <span class="help_text 
line">Angi startdato for prosjektet</span>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                       <span><xsl:value-of 
select="php:function('date', $date_format, number(project/start_date))"/></span>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </dd>
+                                       <dt>
+                                               <label 
for="end_date">Sluttdato</label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <xsl:if 
test="project/error_msg_array/end_date != ''">
+                                                                       
<xsl:variable name="error_msg"><xsl:value-of 
select="project/error_msg_array/end_date" /></xsl:variable>
+                                                                       <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
+                                                               </xsl:if>
+                                                               <input 
class="date" id="end_date" name="end_date" type="text">
+                                                       <xsl:if 
test="project/end_date != ''">
+                                                       <xsl:attribute 
name="value"><xsl:value-of select="php:function('date', $date_format, 
number(project/end_date))"/></xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                               <span class="help_text 
line">Angi sluttdato for prosjektet</span>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                       <span><xsl:value-of 
select="php:function('date', $date_format, number(project/end_date))"/></span>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </dd>
                                </dl>
 
                                <div class="form-buttons">
@@ -89,14 +134,14 @@
                                                        <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
                                                        <input type="submit" 
name="edit_project" value="{$lang_edit}" title = "{$lang_edit}" />
                                                        
-                                                       <xsl:variable 
name="add_new_activity_params">
-                                                               
<xsl:text>menuaction:logistic.uiactivity.edit, project_id:</xsl:text>
+                                                       <xsl:variable 
name="add_new_project_params">
+                                                               
<xsl:text>menuaction:logistic.uiproject.edit, project_id:</xsl:text>
                                                                <xsl:value-of 
select="project/id" />
                                                        </xsl:variable>
-                                                       <xsl:variable 
name="add_new_activity_url">
-                                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $add_new_activity_params 
)" />
+                                                       <xsl:variable 
name="add_new_project_url">
+                                                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $add_new_project_params )" 
/>
                                                        </xsl:variable>
-                                                       <a class="btn 
non-focus" href="{$add_new_activity_url}"><xsl:value-of 
select="php:function('lang', 'Add activity')" /></a>
+                                                       <a class="btn 
non-focus" href="{$add_new_project_url}"><xsl:value-of 
select="php:function('lang', 'Add project')" /></a>
                                                </xsl:otherwise>
                                        </xsl:choose>
                                </div>




reply via email to

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