fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8211] custom config: add date as type


From: Sigurd Nes
Subject: [Fmsystem-commits] [8211] custom config: add date as type
Date: Tue, 29 Nov 2011 12:44:00 +0000

Revision: 8211
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8211
Author:   sigurdne
Date:     2011-11-29 12:43:58 +0000 (Tue, 29 Nov 2011)
Log Message:
-----------
custom config: add date as type

Modified Paths:
--------------
    trunk/admin/inc/class.boconfig.inc.php
    trunk/admin/inc/class.soconfig.inc.php
    trunk/admin/inc/class.uiconfig2.inc.php
    trunk/admin/templates/base/config.xsl
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/export/default/Basware_X114

Modified: trunk/admin/inc/class.boconfig.inc.php
===================================================================
--- trunk/admin/inc/class.boconfig.inc.php      2011-11-29 10:42:46 UTC (rev 
8210)
+++ trunk/admin/inc/class.boconfig.inc.php      2011-11-29 12:43:58 UTC (rev 
8211)
@@ -306,13 +306,29 @@
 
                function select_input_type_list($selected='')
                {
-                       $input_type[0]['id'] = 'text';
-                       $input_type[0]['name'] = 'text';
-                       $input_type[1]['id'] = 'listbox';
-                       $input_type[1]['name'] = 'listbox';
-                       $input_type[2]['id'] = 'password';
-                       $input_type[2]['name'] = 'Password';
-
+                       $input_type = array
+                       (
+                               array
+                               (
+                                       'id' => 'text',
+                                       'name' => 'text'
+                               ),
+                               array
+                               (
+                                       'id' => 'listbox',
+                                       'name' => 'listbox'
+                               ),
+                               array
+                               (
+                                       'id' => 'password',
+                                       'name' => lang('password')
+                               ),
+                               array
+                               (
+                                       'id' => 'date',
+                                       'name' => lang('date')
+                               ),
+                       );
                        return $this->select_list($selected,$input_type);
 
                }

Modified: trunk/admin/inc/class.soconfig.inc.php
===================================================================
--- trunk/admin/inc/class.soconfig.inc.php      2011-11-29 10:42:46 UTC (rev 
8210)
+++ trunk/admin/inc/class.soconfig.inc.php      2011-11-29 12:43:58 UTC (rev 
8211)
@@ -11,6 +11,7 @@
        * @version $Id: class.soconfig.inc.php 3613 2009-09-18 16:19:49Z sigurd 
$
        */
 
+       phpgw::import_class('phpgwapi.datetime');
        /**
         * Description
         * @package admin
@@ -242,17 +243,29 @@
                        {
                                $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $config_info = array();
                        while ($this->db->next_record())
                        {
                                $input_type     = $this->db->f('input_type');
+                               switch($input_type)
+                               {
+                                       case 'password':
+                                               $value = '****';
+                                               break;
+                                       case 'date':
+                                               $value = 
$GLOBALS['phpgw']->common->show_date($this->db->f('value'),$dateformat);
+                                               break;
+                                       default:
+                                               $value = $this->db->f('value', 
true);
+                               }
                                $config_info[] = array
                                (
-                                       'id'            => $this->db->f('id'),
+                                       'id'                    => 
$this->db->f('id'),
                                        'section_id'    => 
$this->db->f('section_id'),
-                                       'value_id'      => 
$this->db->f('value_id'),
-                                       'name'          => $this->db->f('name', 
true),
-                                       'value'         => $input_type == 
'password' && $this->db->f('value') ? '****' : $this->db->f('value', true)
+                                       'value_id'              => 
$this->db->f('value_id'),
+                                       'name'                  => 
$this->db->f('name', true),
+                                       'value'                 => $value
                                );
                        }
                        return $config_info;
@@ -472,6 +485,11 @@
 
                function add_value($values)
                {
+                       if(isset($values['input_type']) && 
$values['input_type'] == 'date')
+                       {
+                               $values['value'] = 
phpgwapi_datetime::date_to_timestamp($values['value']);
+                       }
+
                        $this->db->transaction_begin();
 
                        $values['value'] = 
$this->db->db_addslashes($values['value']);
@@ -499,6 +517,11 @@
 
                function edit_value($values)
                {
+                       if(isset($values['input_type']) && 
$values['input_type'] == 'date')
+                       {
+                               $values['value'] = 
phpgwapi_datetime::date_to_timestamp($values['value']);
+                       }
+
                        if(!$values['value'])
                        {
                                
$this->delete_value($values['section_id'],$values['attrib_id'],$values['id']);

Modified: trunk/admin/inc/class.uiconfig2.inc.php
===================================================================
--- trunk/admin/inc/class.uiconfig2.inc.php     2011-11-29 10:42:46 UTC (rev 
8210)
+++ trunk/admin/inc/class.uiconfig2.inc.php     2011-11-29 12:43:58 UTC (rev 
8211)
@@ -543,7 +543,6 @@
                                $multiple_choice= true;
                        }
 
-
                        $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($receipt);
 
                        $data = array
@@ -814,25 +813,34 @@
                                $values['value'] = '';
                        }
 
+                       if($attrib['input_type'] == 'date')
+                       {
+                               $values['value'] = 
$GLOBALS['phpgw']->common->show_date($values['value'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                               $jscal = CreateObject('phpgwapi.jscalendar');
+                               $jscal->add_listener("date_value");
+                       }
+
                        $data = array
                        (
-                               'lang_section'                                  
=> lang('section'),
-                               'value_section_name'                    => 
$section['name'],
+                               'lang_section'                          => 
lang('section'),
+                               'value_section_name'            => 
$section['name'],
                                'lang_attrib'                           => 
lang('attribute'),
                                'value_attrib_name'                     => 
$attrib['name'],
-
-                               'value_value'                           => 
$values['value'],
+                               'value_input_type'                      => 
$attrib['input_type'],
+                               'value_attrib_value'            => 
$values['value'],
                                'lang_value'                            => 
lang('value'),
                                'choice_list'                           => 
$choice_list,
                                'lang_no_value'                         => 
lang('no value'),
                                'lang_value_status_text'        => lang('select 
value'),
+                               'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                               'lang_datetitle'                        => 
lang('Select date'),
 
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'lang_id'                                       
=> lang('ID'),
                                'lang_save'                                     
=> lang('save'),
                                'lang_cancel'                           => 
lang('cancel'),
-                               'lang_section'                                  
=> lang('section'),
+                               'lang_section'                          => 
lang('section'),
                                'value_section'                         => 
$section['name'],
                                'lang_attrib'                           => 
lang('attribute'),
                                'value_attrib'                          => 
$attrib['name'],

Modified: trunk/admin/templates/base/config.xsl
===================================================================
--- trunk/admin/templates/base/config.xsl       2011-11-29 10:42:46 UTC (rev 
8210)
+++ trunk/admin/templates/base/config.xsl       2011-11-29 12:43:58 UTC (rev 
8211)
@@ -633,19 +633,29 @@
                                </td>
                                <td>
                                <xsl:choose>
-                                       <xsl:when test="choice_list = ''">
-                                               <input type="text" size="20" 
name="values[value]" value="{value_value}">
+                                       <xsl:when test="value_input_type = 
'listbox'">
+                                               <xsl:variable 
name="lang_value_status_text"><xsl:value-of 
select="lang_value_status_text"/></xsl:variable>
+                                               <select name="values[value]" 
class="forms" title="{$lang_value_status_text}">
+                                                       <option 
value=""><xsl:value-of select="lang_no_value"/></option>
+                                                       <xsl:apply-templates 
select="choice_list"/>
+                                               </select>
+                                       </xsl:when>
+                                       <xsl:when test="value_input_type = 
'date'">
+                                               <input type="text" 
id="date_value" name="values[value]" size="10" value="{value_attrib_value}" 
readonly="readonly">
                                                        <xsl:attribute 
name="title">
-                                                               <xsl:value-of 
select="lang_value_status_text"/>
+                                                               <xsl:value-of 
select="lang_date_statustext"/>
                                                        </xsl:attribute>
                                                </input>
+                                               <img id="date_value-trigger" 
src="{img_cal}" alt="{lang_datetitle}" title="{lang_datetitle}" 
style="cursor:pointer; cursor:hand;" />
+                                               <input type="hidden" 
name="values[input_type]" value="date"></input>
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               <xsl:variable 
name="lang_value_status_text"><xsl:value-of 
select="lang_value_status_text"/></xsl:variable>
-                                               <select name="values[value]" 
class="forms" title="{$lang_value_status_text}">
-                                                       <option 
value=""><xsl:value-of select="lang_no_value"/></option>
-                                                       <xsl:apply-templates 
select="choice_list"/>
-                                               </select>
+                                               <input type="text" size="20" 
name="values[value]" value="{value_attrib_value}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_value_status_text"/>
+                                                       </xsl:attribute>
+                                               </input>
+
                                        </xsl:otherwise>
                                </xsl:choose>
                                </td>

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2011-11-29 10:42:46 UTC (rev 
8210)
+++ trunk/property/inc/class.menu.inc.php       2011-11-29 12:43:58 UTC (rev 
8211)
@@ -163,6 +163,7 @@
                                                )
                                        );
 
+
                                $admin_children_accounting = array
                                        (
                                                'accounting_cats'       => array
@@ -195,6 +196,11 @@
                                                        'text'  => 
lang('periodization'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'periodization') )
                                                ),
+                                               'accounting_config'     => array
+                                               (
+                                                       'text'  => 
lang('accounting config'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uiconfig2.index', 'location_id' => 
$GLOBALS['phpgw']->locations->get_id('property', '.invoice')) )
+                                               ),
                                                'accounting_tax'        => array
                                                (
                                                        'text'  => 
lang('Accounting tax'),

Modified: trunk/property/inc/export/default/Basware_X114
===================================================================
--- trunk/property/inc/export/default/Basware_X114      2011-11-29 10:42:46 UTC 
(rev 8210)
+++ trunk/property/inc/export/default/Basware_X114      2011-11-29 12:43:58 UTC 
(rev 8211)
@@ -52,6 +52,7 @@
                        $this->soXport                  = 
CreateObject('property.soXport');     
                        $this->config                   = 
CreateObject('phpgwapi.config','property');
                        $this->config->read_repository();
+                       $this->custom_config    = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
                }
 
                protected function select_vouchers_to_transfer()
@@ -599,11 +600,22 @@
                        {
                                $periode = $oRsBilag[0]['periode'];
                        }
-                       else
+                       else if 
(isset($this->custom_config->config_data['export']['dato_aarsavslutning']) && 
time() < $this->custom_config->config_data['export']['dato_aarsavslutning'])
                        {               
-                               $periode = date('Ym',time());
+                               if(date('Y',time()) == date('Y', 
$this->custom_config->config_data['export']['dato_aarsavslutning']))
+                               {
+                                       $periode = date('Y',time()) - 1 . '11';
+                               }
+                               else
+                               {
+                                       $periode = date('Ym',time());
+                               }
                        }
-
+                       else
+                       {
+                               $periode = date('Ym',time());                   
+                       }
+               
                        $comment = array();
                        foreach ($oRsBilag as $line)
                        {




reply via email to

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