* Resources: Add new "res_creator,res_created,res_modifier and res_modified" columns to the database, and also, set their values in resources_bo

This commit is contained in:
Hadi Nategh 2014-03-18 09:39:30 +00:00
parent e60bc19f6f
commit 5e6e016375
5 changed files with 43 additions and 8 deletions

View File

@ -295,10 +295,14 @@ class resources_bo
// we need an id to save pictures and make links... // we need an id to save pictures and make links...
if(!$resource['res_id']) if(!$resource['res_id'])
{ {
$resource['res_owner'] = $GLOBALS['egw_info']['user']['account_id'];
$resource['res_created'] = egw_time::server2user(time(),'ts');
$resource['res_id'] = $this->so->save($resource); $resource['res_id'] = $this->so->save($resource);
} }
else else
{ {
$resource['res_modifier'] = $GLOBALS['egw_info']['user']['account_id'];
$resource['res_modified'] = egw_time::server2user(time(),'ts');
$old = $this->read($resource['res_id']); $old = $this->read($resource['res_id']);
} }
@ -389,7 +393,7 @@ class resources_bo
$this->so->save(); $this->so->save();
} }
} }
$res_id = $this->so->save($resource); $res_id = $this->so->save($resource);
// History & notifications // History & notifications

View File

@ -13,7 +13,7 @@
$setup_info['resources']['name'] = 'resources'; $setup_info['resources']['name'] = 'resources';
$setup_info['resources']['title'] = 'Resources'; $setup_info['resources']['title'] = 'Resources';
$setup_info['resources']['version'] = '1.9.003'; $setup_info['resources']['version'] = '1.9.004';
$setup_info['resources']['app_order'] = 5; $setup_info['resources']['app_order'] = 5;
$setup_info['resources']['tables'] = array('egw_resources','egw_resources_extra'); $setup_info['resources']['tables'] = array('egw_resources','egw_resources_extra');
$setup_info['resources']['enable'] = 1; $setup_info['resources']['enable'] = 1;
@ -47,3 +47,4 @@ $setup_info['resources']['depends'][] = array( // cause eTemplates is not in the
'versions' => Array('1.7','1.8','1.9') 'versions' => Array('1.7','1.8','1.9')
); );

View File

@ -29,7 +29,11 @@ $phpgw_baseline = array(
'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1'), 'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1'),
'storage_info' => array('type' => 'varchar','precision' => '200'), 'storage_info' => array('type' => 'varchar','precision' => '200'),
'inventory_number' => array('type' => 'varchar','precision' => '20'), 'inventory_number' => array('type' => 'varchar','precision' => '20'),
'deleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8') 'deleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
'res_creator' => array('type' => 'int','meta' => 'user','precision' => '11'),
'res_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
'res_modifier' => array('type' => 'int','meta' => 'user','precision' => '11'),
'res_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8')
), ),
'pk' => array('res_id'), 'pk' => array('res_id'),
'fk' => array(), 'fk' => array(),

View File

@ -349,4 +349,30 @@ function resources_upgrade1_9_001()
function resources_upgrade1_9_002() function resources_upgrade1_9_002()
{ {
return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.003'; return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.003';
} }
function resources_upgrade1_9_003()
{
$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_creator',array(
'type' => 'int',
'meta' => 'user',
'precision' => '11'
));
$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_created',array(
'type' => 'int',
'meta' => 'timestamp',
'precision' => '8'
));
$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_modifier',array(
'type' => 'int',
'meta' => 'user',
'precision' => '11'
));
$GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_modified',array(
'type' => 'int',
'meta' => 'timestamp',
'precision' => '8'
));
return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.004';
}

View File

@ -185,17 +185,17 @@
<description value="Created by"/> <description value="Created by"/>
<hbox> <hbox>
<menulist> <menulist>
<menupopup type="select-account" id="" readonly="true"/> <menupopup type="select-account" id="res_owner" readonly="true"/>
</menulist> </menulist>
<date-time id="info_created" readonly="true" align="right"/> <date-time id="res_created" readonly="true" align="right"/>
</hbox> </hbox>
<description/> <description/>
<description value="Last modified"/> <description value="Last modified"/>
<hbox> <hbox>
<menulist> <menulist>
<menupopup type="select-account" id="" readonly="true"/> <menupopup type="select-account" id="res_modifier" readonly="true"/>
</menulist> </menulist>
<date-time readonly="true" align="right"/> <date-time id="res_modified" readonly="true" align="right"/>
</hbox> </hbox>
</row> </row>
<row class="dialogFooterToolbar"> <row class="dialogFooterToolbar">