fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8200] property: modify id_generator to plan ahead an


From: Sigurd Nes
Subject: [Fmsystem-commits] [8200] property: modify id_generator to plan ahead and to keep the history
Date: Sat, 26 Nov 2011 21:21:36 +0000

Revision: 8200
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8200
Author:   sigurdne
Date:     2011-11-26 21:21:36 +0000 (Sat, 26 Nov 2011)
Log Message:
-----------
property: modify id_generator to plan ahead and to keep the history

Modified Paths:
--------------
    trunk/property/inc/class.soXport.inc.php
    trunk/property/inc/class.soadmin.inc.php
    trunk/property/inc/class.socommon.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiadmin.inc.php
    trunk/property/inc/cron/default/Import_fra_basware_X205.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/admin.xsl

Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php    2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/inc/class.soXport.inc.php    2011-11-26 21:21:36 UTC (rev 
8200)
@@ -227,6 +227,7 @@
                                                $fields['kostra_id'],
                                                $fields['pmwrkord_code'],
                                                $fields['bilagsnr'],
+                                               $fields['bilagsnr_ut'],
                                                $fields['splitt'],
                                                $fields['kildeid'],
                                                $fields['kidnr'],
@@ -262,7 +263,7 @@
 
                                        $values = 
$this->db->validate_insert($values);
 
-                                       $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,fakturadato,"
+                                       $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,bilagsnr_ut,splitt,kildeid,kidnr,typeid,fakturadato,"
                                                . " 
forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
                                                . " 
fakturanr,spbudact_code,loc1,dima,dimd,mvakode,periode,merknad,oppsynsigndato,saksigndato,"
                                                . " 
budsjettsigndato,utbetalingsigndato,item_type,item_id,external_ref,currency,belop,godkjentbelop)"
@@ -274,7 +275,11 @@
                                }
                        }
 
-                       $this->db->query("UPDATE fm_idgenerator set value = 
{$bilagsnr} WHERE name = 'Bilagsnummer'");
+                       $now = time();
+                       $this->db->query("SELECT start_date FROM fm_idgenerator 
WHERE name='Bilagsnummer' AND start_date < {$now} ORDER BY start_date DESC");
+                       $this->db->next_record();
+                       $start_date = (int)$this->db->f('start_date');
+                       $this->db->query("UPDATE fm_idgenerator set value = 
{$bilagsnr} WHERE name = 'Bilagsnummer' AND start_date = {$start_date}");
 
                        $this->db->transaction_commit();
 
@@ -286,6 +291,7 @@
                        $values= array(
                                $data['id'],
                                $data['bilagsnr'],
+                               $data['bilagsnr_ut'],
                                $data['kidnr'],
                                $data['typeid'],
                                $data['kildeid'],
@@ -329,7 +335,7 @@
 
                        $values = $this->db->validate_insert($values);
 
-                       $sql="INSERT INTO fm_ecobilagoverf 
(id,bilagsnr,kidnr,typeid,kildeid,project_id,kostra_id,pmwrkord_code,fakturadato,"
+                       $sql="INSERT INTO fm_ecobilagoverf 
(id,bilagsnr,bilagsnr_ut,kidnr,typeid,kildeid,project_id,kostra_id,pmwrkord_code,fakturadato,"
                                . " 
periode,periodization,periodization_start,forfallsdato,fakturanr,spbudact_code,regtid,artid,spvend_code,dima,loc1,"
                                . " 
dimb,mvakode,dimd,oppsynsmannid,saksbehandlerid,budsjettansvarligid,oppsynsigndato,saksigndato,"
                                . " 
budsjettsigndato,merknad,splitt,utbetalingid,utbetalingsigndato,filnavn,overftid,item_type,item_id,external_ref,"
@@ -553,21 +559,24 @@
 
                function increment_batchid()
                {
-                       $this->db->query("update fm_idgenerator  set value = 
value + 1 where name = 'Ecobatchid'");
-                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'");
+                       $name = 'Ecobatchid';
+                       $now = time();
+                       $this->db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date 
DESC");
                        $this->db->next_record();
-                       $bilagsnr = $this->db->f('value');
-                       return $bilagsnr;
+                       $next_id = $this->db->f('value') +1;
+                       $start_date = (int)$this->db->f('start_date');
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
+
+                       return $next_id;
                }
 
                function next_batchid()
                {
-
-                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'");
+                       $now = time();
+                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name = 'Ecobatchid' AND start_date < {$now} ORDER BY start_date DESC");
                        $this->db->next_record();
-                       $batchid = $this->db->f('value')+1;
-
-                       return $batchid;
+                       $next_id = $this->db->f('value') +1;
+                       return $next_id;
                }
 
                function get_responsible($b_abbount_id)

Modified: trunk/property/inc/class.soadmin.inc.php
===================================================================
--- trunk/property/inc/class.soadmin.inc.php    2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/inc/class.soadmin.inc.php    2011-11-26 21:21:36 UTC (rev 
8200)
@@ -26,6 +26,7 @@
        * @subpackage admin
        * @version $Id$
        */
+       phpgw::import_class('phpgwapi.datetime');
 
        /**
         * Description
@@ -68,37 +69,80 @@
 
                function read_fm_id()
                {
-                       $sql = "SELECT * FROM fm_idgenerator ORDER BY descr 
asc";
+                       $sql = "SELECT * FROM fm_idgenerator ORDER BY descr 
DESC,start_date DESC";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $name = '';
                        $fm_ids = array();
                        while ($this->db->next_record())
                        {
+                               $old = false;
+                               if($name == $this->db->f('name'))
+                               {
+                                       $old = true;
+                               }
+                               $new_name = $this->db->f('name');
                                $fm_ids[] = array
                                (
-                                       'name'          => $this->db->f('name'),
-                                       'descr'         => 
$this->db->f('descr'),
-                                       'value'         => 
$this->db->f('value'),
+                                       'name'                  => $new_name,
+                                       'descr'                 => 
$this->db->f('descr'),
+                                       'value'                 => 
$this->db->f('value'),
+                                       'start_date'    => 
$this->db->f('start_date'),
+                                       'old'                   => $old
                                );
-
+                               $name = $new_name;
                        }
 
-                       return $fm_ids;
+                       return array_reverse($fm_ids);
                }
 
-               function edit_id($values='')
+               function edit_id($values=array())
                {
-                       $field=$values['field'];
-                       $select=$values['select'];
+                       if(!isset($values['select']) || 
!is_array($values['select']))
+                       {
+                               return $receipt['message'][] = array('msg' => 
lang('Nothing to do'));
+                       }
 
-                       while($entry=each($select))
+                       $this->db->transaction_begin();
+                       foreach($values['select'] as $field)
                        {
-                               $n=$entry[0];
+                               $start_date = 
phpgwapi_datetime::date_to_timestamp($values['start_date'][$field]);
+                               
+                               if($start_date < time())
+                               {
+                                       $receipt['error'][] = array('msg' => 
lang('Cannot alter historical values for %1', $field));
+                                       continue;
+                               }
 
-                               $sql = "update  fm_idgenerator set 
value='$values[$n]' where name='$field[$n]'";
+                               $sql = "SELECT value,descr, max(start_date) as 
start_date FROM fm_idgenerator WHERE name='{$field}' GROUP BY value, descr 
ORDER BY start_date ASC";
                                $this->db->query($sql,__LINE__,__FILE__);
+                               while ($this->db->next_record())
+                               {
+                                       $value                  = 
$this->db->f('value');
+                                       $descr                  = 
$this->db->f('descr');
+                                       $old_start_date = 
$this->db->f('start_date');
+                               }
+
+                               if($start_date > $old_start_date)
+                               {
+                                       $sql = "INSERT INTO fm_idgenerator 
(name, descr, value, start_date ) VALUES ('{$field}','{$descr}', 
'{$values[$field]}','{$start_date}')";
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                               }
+                               else if ($start_date < $old_start_date)
+                               {
+                                       $sql = "DELETE FROM fm_idgenerator 
WHERE name = name AND start_date > {$start_date}";
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                                       $sql = "INSERT INTO fm_idgenerator 
(name, descr, value, start_date ) VALUES ('{$field}','{$descr}', 
'{$values[$field]}','{$start_date}')";
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                               }
+                               else
+                               {
+                                       $sql = "UPDATE fm_idgenerator SET value 
= '{$values[$field]}' WHERE name='{$field}' AND start_date  = {$start_date}";
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                               }
                        }
 
+                       $this->db->transaction_commit();
                        $receipt['message'][] = array('msg' => lang('ID is 
updated'));
                        return $receipt;
                }

Modified: trunk/property/inc/class.socommon.inc.php
===================================================================
--- trunk/property/inc/class.socommon.inc.php   2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/inc/class.socommon.inc.php   2011-11-26 21:21:36 UTC (rev 
8200)
@@ -308,6 +308,7 @@
 
                function increment_id($name)
                {
+                       $now = time();
                        if($name == 'order') // FIXME: temporary hack
                        {
                                $name = 'workorder';
@@ -316,11 +317,12 @@
                        {
                                $name = 'workorder';
                        }
-                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name='{$name}'");
+                       $this->db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date 
DESC" );
                        $this->db->next_record();
                        $next_id = $this->db->f('value') +1;
+                       $start_date = (int)$this->db->f('start_date');
 
-                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}'");
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
                        return $next_id;
                }
 

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/inc/class.soinvoice.inc.php  2011-11-26 21:21:36 UTC (rev 
8200)
@@ -934,16 +934,22 @@
 
                function increment_bilagsnr()
                {
-                       $this->db->query("UPDATE fm_idgenerator set value = 
value + 1 where name = 'Bilagsnummer'");
-                       $this->db->query("select value from fm_idgenerator 
where name = 'Bilagsnummer'");
+                       $name = 'Bilagsnummer';
+                       $now = time();
+                       $this->db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name = '{$name}' AND start_date < {$now} ORDER BY 
start_date DESC");
                        $this->db->next_record();
-                       $bilagsnr = $this->db->f('value');
+                       $bilagsnr = $this->db->f('value') +1;
+                       $start_date = (int)$this->db->f('start_date');
+
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
value + 1 WHERE name = '{$name}' AND start_date = $start_date");
                        return $bilagsnr;
                }
 
                function next_bilagsnr()
                {
-                       $this->db->query("select value from fm_idgenerator 
where name = 'Bilagsnummer'");
+                       $name = 'Bilagsnummer';
+                       $now = time();
+                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name = '{$name}' AND start_date < {$now} ORDER BY start_date DESC" );
                        $this->db->next_record();
                        $bilagsnr = $this->db->f('value')+1;
 

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/inc/class.soproject.inc.php  2011-11-26 21:21:36 UTC (rev 
8200)
@@ -681,15 +681,23 @@
 
                function increment_project_id()
                {
-                       $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'project'");
+                       $name = 'project';
+                       $now = time();
+                       $this->db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date 
DESC");
+                       $this->db->next_record();
+                       $next_id = $this->db->f('value') +1;
+                       $start_date = (int)$this->db->f('start_date');
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
                }
 
                function next_project_id()
                {
-                       $this->db->query("select value from fm_idgenerator 
where name = 'project'");
+                       $name = 'project';
+                       $now = time();
+                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name = '{$name}' AND start_date < {$now} ORDER BY start_date DESC");
                        $this->db->next_record();
-                       $project_id = $this->db->f('value')+1;
-                       return $project_id;
+                       $id = $this->db->f('value')+1;
+                       return $id;
                }
 
                function add($project, $values_attribute = array())

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/inc/class.sorequest.inc.php  2011-11-26 21:21:36 UTC (rev 
8200)
@@ -684,12 +684,21 @@
 
                function increment_request_id()
                {
-                       $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'request'");
+                       $name = 'request';
+                       $now = time();
+                       $this->db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date 
DESC");
+                       $this->db->next_record();
+                       $next_id = $this->db->f('value') +1;
+                       $start_date = (int)$this->db->f('start_date');
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
+                       return $next_id;
                }
 
                function next_id()
                {
-                       $this->db->query("select value from fm_idgenerator 
where name = 'request'");
+                       $name = 'request';
+                       $now = time();
+                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name = '{$name}' AND start_date < {$now} ORDER BY start_date DESC");
                        $this->db->next_record();
                        $id = $this->db->f('value')+1;
                        return $id;

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2011-11-25 15:30:50 UTC 
(rev 8199)
+++ trunk/property/inc/class.soworkorder.inc.php        2011-11-26 21:21:36 UTC 
(rev 8200)
@@ -60,7 +60,9 @@
 
                function next_id()
                {
-                       $this->db->query("select value from fm_idgenerator 
where name = 'workorder'");
+                       $name = 'workorder';
+                       $now = time();
+                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name = '{$name}' AND start_date < {$now} ORDER BY start_date DESC");
                        $this->db->next_record();
                        $id = $this->db->f('value')+1;
                        return $id;
@@ -838,7 +840,13 @@
 
                function increment_workorder_id()
                {
-                       $this->db->query("update fm_idgenerator set value = 
value + 1 where name = 'workorder'");
+                       $name = 'workorder';
+                       $now = time();
+                       $this->db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date 
DESC");
+                       $this->db->next_record();
+                       $next_id = $this->db->f('value') +1;
+                       $start_date = (int)$this->db->f('start_date');
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
                }
 
                function add($workorder)

Modified: trunk/property/inc/class.uiadmin.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin.inc.php    2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/inc/class.uiadmin.inc.php    2011-11-26 21:21:36 UTC (rev 
8200)
@@ -602,30 +602,18 @@
                                $receipt = $this->bo->edit_id($values);
                        }
 
-                       $fm_ids = $this->bo->read_fm_id();
+                       $content = $this->bo->read_fm_id();
 
-                       $content = array();
-                       for ($i=0;$i<count($fm_ids);$i++)
-                       {
+                       $jscal = CreateObject('phpgwapi.jscalendar');
 
-                               $content[] = array
-                               (
-                                       'name'          => $fm_ids[$i]['name'],
-                                       'descr'         => $fm_ids[$i]['descr'],
-                                       'value'         => $fm_ids[$i]['value'],
-                                       'remark'        => 
$fm_ids[$i]['remark'],
-                                       'key_id'        => $i
-                               );
+                       $dateformat     = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       foreach($content as $i => & $entry)
+                       {
+                               $jscal->add_listener("date_{$entry['name']}");
+                               $entry['key_id'] = $i;
+                               $entry['start_date']    = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$dateformat);
                        }
-
-                       $table_header = array
-                       (
-                               'lang_select'           => lang('Select'),
-                               'lang_descr'            => lang('Descr'),
-                               'lang_value'            => lang('Value'),
-                               'lang_remark'           => lang('Remark'),
-                       );
-
+//_debug_array($content);die();
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
@@ -638,12 +626,9 @@
                                        'lang_add_statustext'   => lang('Edit 
ID'),
                                        'lang_done'                             
=> lang('done'),
                                        'lang_done_statustext'  => lang('Back 
to Admin'),
-                                       'lang_select'                   => 
lang('Select'),
-                                       'lang_descr'                    => 
lang('Descr'),
-                                       'lang_value'                    => 
lang('Value'),
-                                       'lang_remark'                   => 
lang('Remark'),
-                                       'id_table_header'               => 
$table_header,
                                        'id_values'                             
=> $content,
+                                       'img_cal'                               
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                                       'lang_datetitle'                => 
lang('Select date'),
                                );
 
                        $appname        = lang('ID');

Modified: trunk/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
--- trunk/property/inc/cron/default/Import_fra_basware_X205.php 2011-11-25 
15:30:50 UTC (rev 8199)
+++ trunk/property/inc/cron/default/Import_fra_basware_X205.php 2011-11-26 
21:21:36 UTC (rev 8200)
@@ -359,7 +359,7 @@
 //                                     $_data['SUPPLIERREF']; // => 7869
                                        $_data['VATAMOUNT']; // => 62500
                                        
-                                       $bilagsnr = isset($_data['VOUCHERID']) 
? $_data['VOUCHERID'] : ''; // FIXME: innkommende bilagsnummer?
+                                       $bilagsnr_ut = 
isset($_data['VOUCHERID']) ? $_data['VOUCHERID'] : ''; // FIXME: innkommende 
bilagsnummer?
 
                                        $order_id               = 
$_data['PURCHASEORDERNO'];
                                        $fakturanr              = $_data['KEY'];
@@ -395,7 +395,7 @@
                                        $buffer[$i]['godkjentbelop']    = 
$belop;
                                        
                                        $buffer[$i]['kidnr']                    
= $kidnr;
-                                       $buffer[$i]['bilagsnr']                 
= $bilagsnr;
+                                       $buffer[$i]['bilagsnr_ut']              
= $bilagsnr_ut;
                                        $buffer[$i]['referanse']                
= "ordre: {$order_id}";
 
                                        $order_info = 
$this->get_order_info($order_id);

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2011-11-25 15:30:50 UTC (rev 8199)
+++ trunk/property/setup/setup.inc.php  2011-11-26 21:21:36 UTC (rev 8200)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.627';
+       $setup_info['property']['version']              = '0.9.17.628';
        $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-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/setup/tables_current.inc.php 2011-11-26 21:21:36 UTC (rev 
8200)
@@ -1423,12 +1423,12 @@
                'fm_idgenerator' => array(
                        'fd' => array(
                                'name' => array('type' => 'varchar','precision' 
=> '30','nullable' => False),
+                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => False,'default' => '0'),
                                'value' => array('type' => 'int','precision' => 
'4','nullable' => False),
                                'increment' => array('type' => 
'int','precision' => '4','nullable' => True),
-                               'maxvalue' => array('type' => 'int','precision' 
=> '2','nullable' => True),
-                               'descr' => array('type' => 
'varchar','precision' => '30','nullable' => True)
+                               'descr' => array('type' => 
'varchar','precision' => '30','nullable' => True),
                        ),
-                       'pk' => array('name'),
+                       'pk' => array('name','start_date'),
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/setup/tables_update.inc.php  2011-11-26 21:21:36 UTC (rev 
8200)
@@ -5538,7 +5538,30 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.626 to 0.9.17.627
+       * Add assign voucher id on export from system
+       */
+       $test[] = '0.9.17.627';
+       function property_upgrade0_9_17_627()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
+               
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_idgenerator','date_from','start_date');
+               $GLOBALS['phpgw_setup']->oProc->query('ALTER TABLE 
fm_idgenerator DROP CONSTRAINT fm_idgenerator_pkey',__LINE__,__FILE__);
+               $GLOBALS['phpgw_setup']->oProc->query('ALTER TABLE 
fm_idgenerator ADD CONSTRAINT fm_idgenerator_pkey PRIMARY 
KEY(name,start_date)',__LINE__,__FILE__);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.628';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+
+
+
+
        /**
        * Update property version from 0.9.17.607 to 0.9.17.608
        * Add more room for address at tickets

Modified: trunk/property/templates/base/admin.xsl
===================================================================
--- trunk/property/templates/base/admin.xsl     2011-11-25 15:30:50 UTC (rev 
8199)
+++ trunk/property/templates/base/admin.xsl     2011-11-26 21:21:36 UTC (rev 
8200)
@@ -753,7 +753,7 @@
 
 <!-- edit_id -->       
 
-       <xsl:template match="id_values">
+       <xsl:template match="id_values" xmlns:php="http://php.net/xsl";>
                <xsl:variable name="value"><xsl:value-of 
select="value"/></xsl:variable>
                <xsl:variable name="key_id"><xsl:value-of 
select="key_id"/></xsl:variable>
                <xsl:variable name="descr"><xsl:value-of 
select="descr"/></xsl:variable>
@@ -773,46 +773,62 @@
                                </xsl:choose>
                        </xsl:attribute>
 
-                       <td align="right">
-                               <INPUT type="checkbox" 
name="values[select][{$key_id}]" value="true"></INPUT>
+                       <td align="center">
+                               <INPUT type="checkbox" name="values[select][]" 
value="{$name}">
+                                       <xsl:if test="old = '1'">
+                                               <xsl:attribute name="disabled">
+                                                       
<xsl:text>disabled</xsl:text>
+                                               </xsl:attribute>
+                                       </xsl:if>
+                               </INPUT>
                        </td>
-                       <td align="right">
+                       <td align="left">
                                <xsl:value-of select="descr"/>
                        </td>
                        <td>
-                               <INPUT type="hidden" 
name="values[field][{$key_id}]" value="{$name}" ></INPUT>
-                               <INPUT type="text" name="values[{$key_id}]" 
value="{$value}" ></INPUT>
+                               <INPUT type="text" name="values[{$name}]" 
value="{$value}" ></INPUT>
                        </td>
-                       <td align="center">
-                               <xsl:value-of select="remark"/>
+                       <td>
+                       <xsl:choose>
+                               <xsl:when test="old != '1'">
+                                       <input type="text" id="date_{$name}" 
name="values[start_date][{$name}]" size="10" value="{start_date}" 
readonly="readonly">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_date_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                                       <img id="date_{$name}-trigger" 
src="{//img_cal}" alt="{//lang_datetitle}" title="{//lang_datetitle}" 
style="cursor:pointer; cursor:hand;" />
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:value-of select="start_date"/>
+                               </xsl:otherwise>
+                       </xsl:choose>
                        </td>
                </tr>
        </xsl:template>
 
-       <xsl:template match="id_table_header">
+       <xsl:template name="id_table_header" xmlns:php="http://php.net/xsl";>
                <tr class="th">
-                       <td class="th_text" width="10%" align="right">
-                               <xsl:value-of select="lang_select"/>
+                       <td class="th_text" width="10%" align="center">
+                               <xsl:value-of select="php:function('lang', 
'select')" />
                        </td>
-                       <td class="th_text" width="10%" align="right">
-                               <xsl:value-of select="lang_descr"/>
+                       <td class="th_text" width="40%" align="left">
+                               <xsl:value-of select="php:function('lang', 
'descr')" />
                        </td>
-                       <td class="th_text" width="40%">
-                               <xsl:value-of select="lang_value"/>
+                       <td class="th_text" width="30%">
+                               <xsl:value-of select="php:function('lang', 
'value')" />
                        </td>
                        <td class="th_text" width="20%" align="center">
-                               <xsl:value-of select="lang_remark"/>
+                               <xsl:value-of select="php:function('lang', 
'date')" />
                        </td>
                </tr>
        </xsl:template>
 
-       <xsl:template match="edit_id">
-
-               <table cellpadding="2" cellspacing="2" width="100%" 
align="center">
+       <xsl:template match="edit_id" xmlns:php="http://php.net/xsl";>
+               <table cellpadding="2" cellspacing="2" width="90%" 
align="center">
                        <xsl:choose>
                                <xsl:when test="msgbox_data != ''">
                                        <tr>
-                                               <td align="left" colspan="3">
+                                               <td align="left" colspan="4">
                                                        <xsl:call-template 
name="msgbox"/>
                                                </td>
                                        </tr>
@@ -820,16 +836,14 @@
                        </xsl:choose>
                        <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
                        <form method="post" action="{$form_action}">
-                               <xsl:apply-templates select="id_table_header"/> 
+                               <xsl:call-template name="id_table_header"/> 
                                <xsl:apply-templates select="id_values"/> 
                                <tr height="50">
                                        <td>
                                                <xsl:variable 
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
-                                               <input type="submit" 
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return 
true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
+                                               <input type="submit" 
name="values[save]" value="{$lang_save}">
+                                                       <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_save_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
                                                        </xsl:attribute>
                                                </input>
                                        </td>
@@ -840,11 +854,9 @@
                                        <xsl:variable 
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
                                        <xsl:variable 
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
                                        <form method="post" 
action="{$done_action}">
-                                               <input type="submit" 
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
-                                                       <xsl:attribute 
name="onMouseover">
-                                                               
<xsl:text>window.status='</xsl:text>
+                                               <input type="submit" 
name="done" value="{$lang_done}">
+                                                       <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_done_statustext"/>
-                                                               <xsl:text>'; 
return true;</xsl:text>
                                                        </xsl:attribute>
                                                </input>
                                        </form>




reply via email to

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