[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13728] controller: added history on assigned to seri
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13728] controller: added history on assigned to serie |
Date: |
Sun, 16 Aug 2015 15:06:30 +0000 |
Revision: 13728
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13728
Author: sigurdne
Date: 2015-08-16 15:06:29 +0000 (Sun, 16 Aug 2015)
Log Message:
-----------
controller: added history on assigned to serie
Modified Paths:
--------------
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/setup/setup.inc.php
trunk/controller/setup/tables_current.inc.php
trunk/controller/setup/tables_update.inc.php
trunk/property/inc/class.uientity.inc.php
trunk/property/js/yahoo/entity.edit.js
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2015-08-16 12:53:01 UTC
(rev 13727)
+++ trunk/controller/inc/class.socontrol.inc.php 2015-08-16 15:06:29 UTC
(rev 13728)
@@ -1002,6 +1002,11 @@
$this->db->query("INSERT INTO
controller_control_serie (" . implode(',',array_keys($values_insert)) . ')
VALUES ('
.
$this->db->validate_insert(array_values($values_insert)) .
')',__LINE__,__FILE__);
+ $assigned_date = time();
+ $serie_id =
$this->db->get_last_insert_id('controller_control_serie', 'id');
+ $this->db->query("INSERT INTO
controller_control_serie_history (serie_id, assigned_to, assigned_date)"
+ . " VALUES
({$serie_id}, {$assigned_to}, {$assigned_date}) ");
+
$ret = PHPGW_ACL_ADD; // Bit -
add
}
}
@@ -1531,6 +1536,7 @@
$ids = $data['ids'];
$action = $data['action'];
$value_set = array();
+ $add_history = false;
switch($action)
{
case 'enable':
@@ -1543,6 +1549,7 @@
if($data['assigned_to'])
{
$value_set['assigned_to']
= $data['assigned_to'];
+ $add_history = true;
}
if($data['start_date'])
{
@@ -1574,6 +1581,22 @@
$sql = "UPDATE controller_control_serie SET
{$value_set_update} WHERE id IN (" . implode(',', $ids) . ')';
if($this->db->query($sql,__LINE__,__FILE__))
{
+ if($add_history && $value_set['assigned_to'])
+ {
+ $assigned_date = time();
+
+ foreach($ids as $serie_id)
+ {
+ $this->db->query("SELECT
assigned_to FROM controller_control_serie_history WHERE serie_id = {$serie_id}
ORDER BY id DESC",__LINE__,__FILE__);
+ $this->db->next_record();
+ if($value_set['assigned_to']
!=$this->db->f('assigned_to'))
+ {
+
$this->db->query("INSERT INTO controller_control_serie_history (serie_id,
assigned_to, assigned_date)"
+ . " VALUES
({$serie_id}, {$value_set['assigned_to']}, {$assigned_date}) ");
+ }
+ }
+ }
+
return PHPGW_ACL_EDIT; // Bit - edit
}
}
@@ -1686,11 +1709,32 @@
}
return $serie;
}
- function get_check_list_id_for_deadline($serie_id, $deadline_ts
= 0)
+ public function get_check_list_id_for_deadline($serie_id,
$deadline_ts = 0)
{
$sql = "SELECT id FROM controller_check_list WHERE
deadline = {$deadline_ts} AND serie_id = ". (int) $serie_id;
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
return $this->db->f('id');
}
+
+ public function get_assigned_history($data)
+ {
+ $serie_id = (int) $data['serie_id'];
+ $sql = "SELECT * FROM controller_control_serie_history
WHERE serie_id = {$serie_id} ORDER BY id";
+ $this->db->query($sql,__LINE__,__FILE__);
+ $history = array();
+ while ($this->db->next_record())
+ {
+ $history[] = array
+ (
+ 'assigned_to' =>
$this->db->f('assigned_to'),
+ 'assigned_date' =>
$this->db->f('assigned_date'),
+ );
+ }
+ foreach($history as &$entry)
+ {
+ $entry['assigned_to_name'] =
$GLOBALS['phpgw']->accounts->get($entry['assigned_to'])->__toString();
+ }
+ return $history;
+ }
}
Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php 2015-08-16 12:53:01 UTC (rev
13727)
+++ trunk/controller/setup/setup.inc.php 2015-08-16 15:06:29 UTC (rev
13728)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.52';
+ $setup_info['controller']['version'] = '0.1.53';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
@@ -49,6 +49,8 @@
'controller_control_group_list',
'controller_control_location_list',
'controller_control_component_list',
+ 'controller_control_serie',
+ 'controller_control_serie_history',
'controller_control_group_component_list',
'controller_document',
'controller_document_types',
Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php 2015-08-16 12:53:01 UTC
(rev 13727)
+++ trunk/controller/setup/tables_current.inc.php 2015-08-16 15:06:29 UTC
(rev 13728)
@@ -174,6 +174,18 @@
'ix' => array(),
'uc' => array()
),
+ 'controller_control_serie_history' => array(
+ 'fd' => array(
+ 'id'
=> array('type' => 'auto', 'nullable' => false),
+ 'serie_id'
=> array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'assigned_to' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'assigned_date' =>
array('type' => 'int', 'precision' => '8', 'nullable' => false),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('controller_control_serie' =>
array('serie_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'controller_control_group_component_list' => array(
'fd' => array(
'id'
=> array('type' => 'auto', 'nullable' => false),
Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php 2015-08-16 12:53:01 UTC
(rev 13727)
+++ trunk/controller/setup/tables_update.inc.php 2015-08-16 15:06:29 UTC
(rev 13728)
@@ -1097,3 +1097,48 @@
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.52';
return $GLOBALS['setup_info']['controller']['currentver'];
}
+
+ $test[] = '0.1.52';
+ function controller_upgrade0_1_52()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'controller_control_serie_history', array(
+ 'fd' => array(
+ 'id'
=> array('type' => 'auto', 'nullable' => false),
+ 'serie_id'
=> array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'assigned_to'
=> array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'assigned_date'
=> array('type' => 'int', 'precision' => '8', 'nullable' => false),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array('controller_control_serie' =>
array('serie_id' => 'id')),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query('SELECT * FROM
controller_control_serie');
+
+ $series = array();
+ while($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $series[] = array(
+ 'serie_id' =>
$GLOBALS['phpgw_setup']->oProc->f('id'),
+ 'assigned_to' =>
$GLOBALS['phpgw_setup']->oProc->f('assigned_to'),
+ 'assigned_date' => time()
+ );
+ }
+
+ foreach($series as $serie)
+ {
+ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO
controller_control_serie_history (serie_id, assigned_to, assigned_date)"
+ . " VALUES ({$serie['serie_id']},
{$serie['assigned_to']}, {$serie['assigned_date']}) ");
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.53';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php 2015-08-16 12:53:01 UTC (rev
13727)
+++ trunk/property/inc/class.uientity.inc.php 2015-08-16 15:06:29 UTC (rev
13728)
@@ -54,23 +54,24 @@
var $public_functions = array
(
- 'columns' => true,
- 'download' => true,
- 'view' => true,
- 'edit' => true,
- 'delete' => true,
- 'view_file' => true,
- 'attrib_history' => true,
- 'attrib_help' => true,
- 'print_pdf' => true,
- 'index' => true,
- 'addfiles' => true,
- 'get_files' => true,
- 'get_inventory' => true,
- 'add_inventory' => true,
- 'edit_inventory' => true,
- 'inventory_calendar'=> true,
- 'get_controls_at_component'=>true
+ 'columns'
=> true,
+ 'download'
=> true,
+ 'view'
=> true,
+ 'edit'
=> true,
+ 'delete'
=> true,
+ 'view_file'
=> true,
+ 'attrib_history' => true,
+ 'attrib_help' => true,
+ 'print_pdf'
=> true,
+ 'index'
=> true,
+ 'addfiles'
=> true,
+ 'get_files'
=> true,
+ 'get_inventory' => true,
+ 'add_inventory' => true,
+ 'edit_inventory' => true,
+ 'inventory_calendar' => true,
+ 'get_controls_at_component' => true,
+ 'get_assigned_history' => true
);
function __construct()
@@ -2815,6 +2816,59 @@
$this->edit($mode = 'view');
}
+ function get_assigned_history()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+ if($this->acl_read)
+ {
+ $this->bocommon->no_access();
+ return;
+ }
+ $serie_id = phpgw::get_var('serie_id',
'int');
+ $history =
execMethod('controller.socontrol.get_assigned_history', array('serie_id' =>
$serie_id));
+ $lang_user = lang('user');
+ $lang_date = lang('date');
+
+ $ret = <<<HTML
+ <html>
+ <head>
+ </head>
+ <body>
+ <table style="width:90%" align =
'center'>
+ <tr align = 'left'>
+ <th>
+ {$lang_user}
+ </th>
+ <th>
+ {$lang_date}
+ </th>
+ </tr>
+
+HTML;
+ foreach($history as $entry)
+ {
+ $date =
$GLOBALS['phpgw']->common->show_date($entry['assigned_date']);
+ $ret .= <<<HTML
+ <tr align = 'left'>
+ <td>
+
{$entry['assigned_to_name']}
+ </td>
+ <td>
+ {$date}
+ </td>
+ </tr>
+HTML;
+ }
+ $ret .= <<<HTML
+ </table>
+ </body>
+ </html>
+HTML;
+ echo $ret;
+ }
+
function attrib_history()
{
$GLOBALS['phpgw']->xslttpl->add_file(array('attrib_history','nextmatchs'));
@@ -3580,6 +3634,7 @@
"3"=> lang('year')
);
+ $lang_history = lang('history');
$controls =
execMethod('controller.socontrol.get_controls_at_component',
array('location_id' => $location_id, 'component_id' => $id));
foreach($controls as &$entry)
{
@@ -3610,6 +3665,7 @@
);
$entry['title'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$control_link_data).'"
target="_blank">'.$entry['title'].'</a>';
+ $entry['assigned_to_name'] = "<a
title=\"{$lang_history}\"
onclick='javascript:showlightbox_assigned_history({$entry['serie_id']});'>{$entry['assigned_to_name']}</a>";
$entry['start_date'] =
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
$entry['repeat_type'] =
$repeat_type_array[$entry['repeat_type']];
Modified: trunk/property/js/yahoo/entity.edit.js
===================================================================
--- trunk/property/js/yahoo/entity.edit.js 2015-08-16 12:53:01 UTC (rev
13727)
+++ trunk/property/js/yahoo/entity.edit.js 2015-08-16 15:06:29 UTC (rev
13728)
@@ -280,7 +280,17 @@
});
}
+ this.showlightbox_assigned_history = function(serie_id)
+ {
+ var oArgs =
{menuaction:'property.uientity.get_assigned_history', serie_id:serie_id};
+ var sUrl = phpGWLink('index.php', oArgs);
+ TINY.box.show({iframe:sUrl,
boxid:'frameless',width:400,height:350,fixed:false,maskid:'darkmask',maskopacity:40,
mask:true, animate:true,
+ close: true,
+ closejs:false
+ });
+ }
+
this.refresh_inventory = function(location_id, id)
{
var oArgs = {menuaction:'property.uientity.get_inventory',
location_id:location_id, id: id};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13728] controller: added history on assigned to serie,
Sigurd Nes <=