[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8406] bulk update status
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8406] bulk update status |
Date: |
Wed, 21 Dec 2011 15:48:47 +0000 |
Revision: 8406
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8406
Author: sigurdne
Date: 2011-12-21 15:48:47 +0000 (Wed, 21 Dec 2011)
Log Message:
-----------
bulk update status
Modified Paths:
--------------
trunk/property/inc/class.boproject.inc.php
trunk/property/inc/class.menu.inc.php
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.uiproject.inc.php
trunk/property/templates/base/project.xsl
Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php 2011-12-21 14:30:08 UTC (rev
8405)
+++ trunk/property/inc/class.boproject.inc.php 2011-12-21 15:48:47 UTC (rev
8406)
@@ -806,4 +806,8 @@
$this->so->delete($project_id);
}
+ function bulk_update_status($start_date, $end_date, $status,
$execute, $type)
+ {
+ return $this->so->bulk_update_status($start_date,
$end_date, $status, $execute, $type);
+ }
}
Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php 2011-12-21 14:30:08 UTC (rev
8405)
+++ trunk/property/inc/class.menu.inc.php 2011-12-21 15:48:47 UTC (rev
8406)
@@ -451,6 +451,11 @@
'text' =>
lang('project status'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'project_status') )
),
+ 'project_bulk_update_status'
=> array
+ (
+ 'text' =>
lang('project status'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiproject.bulk_update_status') )
+ ),
'project_group' => array
(
'text' =>
lang('project group'),
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2011-12-21 14:30:08 UTC (rev
8405)
+++ trunk/property/inc/class.soproject.inc.php 2011-12-21 15:48:47 UTC (rev
8406)
@@ -1266,21 +1266,53 @@
$this->db->query("UPDATE fm_request set
project_id = NULL where id='{$request_id}'",__LINE__,__FILE__);
}
- $this->db->query("DELETE FROM fm_project WHERE id='" .
$project_id . "'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM fm_project WHERE
id='{$project_id}'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_project_history WHERE
history_record_id='" . $project_id . "'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_projectbranch WHERE
project_id='" . $project_id . "'",__LINE__,__FILE__);
// $this->db->query("DELETE FROM fm_origin WHERE
destination ='project' AND destination_id ='" . $project_id .
"'",__LINE__,__FILE__);
$this->interlink->delete_at_origin('property',
'.project.request', '.project', $project_id, $this->db);
$this->interlink->delete_at_target('property',
'.project', $project_id, $this->db);
- $this->db->query("DELETE FROM fm_workorder WHERE
project_id='" . $project_id . "'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM fm_workorder WHERE
project_id='{$project_id}'",__LINE__,__FILE__);
for ($i=0;$i<count($workorder_id);$i++)
{
- $this->db->query("DELETE FROM fm_wo_hours WHERE
workorder_id='" . $workorder_id[$i] . "'",__LINE__,__FILE__);
- $this->db->query("DELETE FROM
fm_workorder_history WHERE history_record_id='" . $workorder_id[$i] .
"'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM fm_wo_hours WHERE
workorder_id='{$workorder_id[$i]}'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM
fm_workorder_history WHERE
history_record_id='{$workorder_id[$i]}'",__LINE__,__FILE__);
}
$this->db->transaction_commit();
}
+
+
+ function bulk_update_status($start_date, $end_date, $status,
$execute, $type)
+ {
+ $start_date =
phpgwapi_datetime::date_to_timestamp($start_date);
+ $end_date =
phpgwapi_datetime::date_to_timestamp($end_date);
+
+ $this->db->query("SELECT id FROM fm_project WHERE
start_date > $start_date AND start_date < $end_date",__LINE__,__FILE__);
+ $projects = array();
+ while ($this->db->next_record())
+ {
+ $projects[] = array('project_id' =>
$this->db->f('id'));
+ }
+
+ foreach($projects as &$project)
+ {
+ $this->db->query("SELECT id FROM fm_workorder
WHERE project_id = {$project['project_id']}",__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $project['workorder'][] =
$this->db->f('id');
+ }
+ }
+
+ return $projects;
+
+
+ $this->db->transaction_begin();
+
+
+ $this->db->transaction_commit();
+ }
+
}
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2011-12-21 14:30:08 UTC (rev
8405)
+++ trunk/property/inc/class.uiproject.inc.php 2011-12-21 15:48:47 UTC (rev
8406)
@@ -51,14 +51,14 @@
var $public_functions = array
(
- 'download' => true,
- 'index' => true,
- 'view' => true,
- 'edit' => true,
- 'delete' => true,
- 'date_search' => true,
- 'columns' => true,
- 'update_data' => true,
+ 'download' => true,
+ 'index' => true,
+ 'view' => true,
+ 'edit' => true,
+ 'delete' => true,
+ 'date_search' => true,
+ 'columns' => true,
+ 'bulk_update_status' => true
);
function property_uiproject()
@@ -1951,6 +1951,80 @@
// $GLOBALS['phpgw']->xslttpl->pp();
}
+
+ function bulk_update_status()
+ {
+ if(!$this->acl->check('.project', PHPGW_ACL_PRIVATE,
'property'))//manage
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>PHPGW_ACL_PRIVATE,
'acl_location'=>$this->acl_location));
+ }
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'property::admin::project_bulk_update_status';
+ $start_date = phpgw::get_var('start_date');
+ $end_date = phpgw::get_var('end_date');
+ $confirm = phpgw::get_var('confirm',
'bool', 'POST');
+ $execute = phpgw::get_var('execute',
'bool', 'POST');
+ $status = phpgw::get_var('status');
+ $type = phpgw::get_var('type');
+
+ $link_data = array
+ (
+ 'menuaction' => 'property.uiproject.index'
+ );
+
+ $jscal = CreateObject('phpgwapi.jscalendar');
+ $jscal->add_listener('values_start_date');
+ $jscal->add_listener('values_end_date');
+
+
+ if(($execute || $confirm) && $type)
+ {
+ $list =
$this->bo->bulk_update_status($start_date, $end_date, $status, $execute, $type);
+ }
+
+// _debug_array($list);
+
+ $type_array = array
+ (
+ array
+ (
+ 'id' => '0',
+ 'name' => lang('select')
+ ),
+ array
+ (
+ 'id' => 'project',
+ 'name' => lang('project')
+ ),
+ array
+ (
+ 'id' => 'workorder',
+ 'name' => lang('workorder')
+ )
+ );
+
+ $data = array
+ (
+ 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'update_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.bulk_update_status')),
+ 'img_cal' =>
$GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+ 'confirm' => $confirm,
+ 'status_list' => array('options' =>
$this->bo->select_status_list('select',$status)),
+ 'type_list' =>
array('options' => $type_array),
+ 'start_date' => $start_date,
+ 'end_date' => $end_date,
+ );
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('project'));
+
+ $appname = lang('project');
+ $function_msg = lang('bulk update status');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('bulk_update_status' =>
$data));
+ }
+
+
function view()
{
if(!$this->acl_read)
Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl 2011-12-21 14:30:08 UTC (rev
8405)
+++ trunk/property/templates/base/project.xsl 2011-12-21 15:48:47 UTC (rev
8406)
@@ -1244,4 +1244,84 @@
</xsl:template>
+ <xsl:template match="bulk_update_status" xmlns:php="http://php.net/xsl">
+ <form method="post" action="{update_action}">
+ <table>
+ <tr>
+ <td>
+ <xsl:value-of
select="php:function('lang', 'start date')" />
+ </td>
+ <td>
+ <input type="text"
id="values_start_date" name="start_date" size="10" value="{start_date}"
readonly="readonly">
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="lang_start_date_statustext"/>
+ </xsl:attribute>
+ </input>
+ <img
id="values_start_date-trigger" src="{img_cal}" alt="{lang_datetitle}"
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of
select="php:function('lang', 'end date')" />
+ </td>
+ <td>
+ <input type="text"
id="values_end_date" name="end_date" size="10" value="{end_date}"
readonly="readonly">
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="lang_end_date_statustext"/>
+ </xsl:attribute>
+ </input>
+ <img
id="values_end_date-trigger" src="{img_cal}" alt="{lang_datetitle}"
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of
select="php:function('lang', 'type')" />
+ </td>
+ <td>
+ <select name="status" >
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="php:function('lang', 'select type')" />
+ </xsl:attribute>
+ <xsl:apply-templates
select="type_list/options"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <xsl:value-of
select="php:function('lang', 'status')" />
+ </td>
+ <td>
+ <select name="status" >
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="php:function('lang', 'select status')" />
+ </xsl:attribute>
+ <option value="0">
+ <xsl:value-of
select="php:function('lang', 'select status')" />
+ </option>
+ <xsl:apply-templates
select="status_list/options"/>
+ </select>
+ </td>
+ </tr>
+
+ </table>
+ <input type="text" id="execute" name="execute"
value="{confirm}" />
+ <input type="submit" name="confirm">
+ <xsl:attribute name="value">
+ <xsl:value-of
select="php:function('lang', 'update')" />
+ </xsl:attribute>
+ </input>
+ </form>
+ </xsl:template>
+
+
+ <xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected"
/>
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes"
select="name"/>
+ </option>
+ </xsl:template>
+
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8406] bulk update status,
Sigurd Nes <=