[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9816]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [9816] |
Date: |
Sun, 29 Jul 2012 19:33:19 +0000 |
Revision: 9816
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9816
Author: vator
Date: 2012-07-29 19:33:18 +0000 (Sun, 29 Jul 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/model/class.check_list.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/templates/base/check_list/edit_check_list.xsl
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2012-07-29 09:55:49 UTC
(rev 9815)
+++ trunk/controller/inc/class.socheck_list.inc.php 2012-07-29 19:33:18 UTC
(rev 9816)
@@ -59,44 +59,28 @@
*/
public function get_single($check_list_id){
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.control_id, cl.comment as cl_comment, deadline, planned_date, ";
- $sql .= "completed_date, location_code, component_id,
num_open_cases, num_pending_cases, location_id, ci.id as ci_id,
control_item_id, ";
- $sql .= "check_list_id ";
+ $sql .= "completed_date, location_code, component_id,
num_open_cases, num_pending_cases, location_id, ci.id as ci_id, control_item_id
";
$sql .= "FROM controller_check_list cl ";
$sql .= "LEFT JOIN controller_check_item as ci ON cl.id =
ci.check_list_id ";
$sql .= "WHERE cl.id = $check_list_id";
-
- $this->db->query($sql);
- $counter = 0;
- $check_list = null;
- while ($this->db->next_record()) {
+ $this->db->query($sql);
+ $this->db->next_record();
- if($counter == 0){
- $check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-
$check_list->set_control_id($this->unmarshal($this->db->f('control_id', true),
'int'));
-
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'int'));
-
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
-
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
-
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date',
true), 'int'));
-
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
-
$check_list->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
-
$check_list->set_component_id($this->unmarshal($this->db->f('component_id',
true), 'int'));
-
$check_list->set_location_id($this->unmarshal($this->db->f('location_id',
true), 'int'));
-
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases',
true), 'int'));
-
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases',
true), 'int'));
- }
+ $check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
+
$check_list->set_control_id($this->unmarshal($this->db->f('control_id', true),
'int'));
+
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'int'));
+
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
+
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date',
true), 'int'));
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
+
$check_list->set_component_id($this->unmarshal($this->db->f('component_id',
true), 'int'));
+
$check_list->set_location_id($this->unmarshal($this->db->f('location_id',
true), 'int'));
+
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases',
true), 'int'));
+
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases',
true), 'int'));
- $check_item = new
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
true), 'int'));
-
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id',
true), 'int'));
-
- $check_items_array[] = $check_item;
-
- $counter++;
- }
-
if($check_list != null){
- $check_list->set_check_item_array($check_items_array);
return $check_list;
}else {
return null;
@@ -823,7 +807,14 @@
$result = $this->db->query('UPDATE controller_check_list SET '
. join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
- return isset($result);
+ if(isset($result))
+ {
+ return $id;
+ }
+ else
+ {
+ return 0;
+ }
}
function get_id_field_name($extended_info = false)
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2012-07-29 09:55:49 UTC
(rev 9815)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2012-07-29 19:33:18 UTC
(rev 9816)
@@ -282,6 +282,7 @@
$check_list =
$this->so->get_single($check_list_id);
}
+
$cl_status_updater = new check_list_status_updater();
$cl_status_updater->update_check_list_status(
$check_list_id );
@@ -358,8 +359,7 @@
$planned_date = phpgw::get_var('planned_date',
'string');
$completed_date = phpgw::get_var('completed_date',
'string');
$comment = phpgw::get_var('comment', 'string');
- $return_format = phpgw::get_var('phpgw_return_as');
-
+
$deadline_date_ts =
date_helper::get_timestamp_from_date( $deadline_date, "d/m-Y" );
if($planned_date != ''){
@@ -375,55 +375,46 @@
$completed_date_ts = 0;
}
- if(check_list_id > 0)
+ if($check_list_id > 0)
{
$check_list =
$this->so->get_single($check_list_id);
}
else
{
$check_list = new controller_check_list();
+ $check_list->set_control_id($control_id);
+
+ if($type == "component"){
+ $location_id =
phpgw::get_var('location_id');
+ $component_id =
phpgw::get_var('component_id');
+ $check_list->set_location_id(
$location_id );
+ $check_list->set_component_id(
$component_id );
+ }else {
+ $location_code =
phpgw::get_var('location_code');
+ $check_list->set_location_code(
$location_code );
+ }
}
- $check_list->set_location_code($location_code);
- $check_list->set_control_id($control_id);
$check_list->set_status($status);
$check_list->set_comment($comment);
$check_list->set_deadline( $deadline_date_ts );
$check_list->set_planned_date($planned_date_ts);
$check_list->set_completed_date($completed_date_ts);
-
- if($type == "component"){
- $location_id = phpgw::get_var('location_id');
- $component_id = phpgw::get_var('component_id');
- $check_list->set_location_id( $location_id );
- $check_list->set_component_id( $component_id );
- }else {
- $location_code =
phpgw::get_var('location_code');
- $check_list->set_location_code( $location_code
);
- }
- echo " SAVE ";
- print_r($check_list);
+
if( $check_list->validate() )
{
- $check_list_id = $this->so->store($check_list);
+ $check_list_id =
$this->so->store($check_list);
- if( ($check_list_id > 0) & ($return_format !=
'json') )
+ if( $check_list_id > 0 )
{
- $this->redirect(array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id'=>$check_list_id));
+ $this->redirect(array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
}
- else if( ($check_list_id > 0) & ($return_format
== 'json') )
- {
- return json_encode( array( "status" =>
"updated" ) );
+ else{
+ $this->edit_check_list($check_list);
}
- else
- {
- return json_encode( array( "status" =>
"not_updated" ) );
- }
}
else
{
- echo "i validate failed";
-
if($check_list->get_id() > 0)
{
$this->edit_check_list($check_list);
Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2012-07-29 09:55:49 UTC
(rev 9815)
+++ trunk/controller/inc/model/class.check_list.inc.php 2012-07-29 19:33:18 UTC
(rev 9816)
@@ -233,10 +233,11 @@
}
// Validate connection to COMPONENT/LOCATION
- if( empty( $this->location_code ) && empty(
$this->component_id ))
+ if( empty( $this->location_code ) && empty(
$this->component_id ) )
{
+ echo "FAILED: " . $this->location_code;
$status = false;
- $this->error_msg_array['deadline'] = "error_msg_6";
+ $this->error_msg_array['location_code'] = "error_msg_6";
}
return $status;
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2012-07-29 09:55:49 UTC (rev
9815)
+++ trunk/controller/js/controller/ajax.js 2012-07-29 19:33:18 UTC (rev
9816)
@@ -573,20 +573,35 @@
var requestUrl = $(thisForm).attr("action");
var check_list_id = $("#check_list_id").val();
-
- if(check_list_id > 0){
- e.preventDefault();
var statusFieldVal = $("#status").val();
+ var statusRow = $("#status").closest(".row");
+ var plannedDateVal = $("#planned_date").val();
+ var plannedDateRow = $("#planned_date").closest(".row");
var completedDateVal = $("#completed_date").val();
var completedDateRow =
$("#completed_date").closest(".row");
// Checks that COMPLETE DATE is set if status is set to
DONE
if(statusFieldVal == 1 & completedDateVal == ''){
+ e.preventDefault();
// Displays error message above completed date
$(completedDateRow).before("<div
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
- }else{
-
+ }
+ else if(statusFieldVal == 0 && completedDateVal != ''){
+ e.preventDefault();
+ // Displays error message above completed date
+ $(statusRow).before("<div
class='input_error_msg'>Vennligst endre status til utført</div>");
+ }
+ else if(statusFieldVal == 0 & plannedDateVal == ''){
+ e.preventDefault();
+ // Displays error message above planned date
+ if(
!$(plannedDateRow).prev().hasClass("input_error_msg") )
+ {
+ $(plannedDateRow).before("<div
class='input_error_msg'>Vennligst endre status for kontroll eller angi
planlagtdato</div>");
+ }
+ }
+ /*
+ else{
$(".input_error_msg").hide();
$.ajax({
@@ -610,7 +625,7 @@
}
});
}
- }
+ */
});
// Display submit button on click
Modified: trunk/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- trunk/controller/templates/base/check_list/edit_check_list.xsl
2012-07-29 09:55:49 UTC (rev 9815)
+++ trunk/controller/templates/base/check_list/edit_check_list.xsl
2012-07-29 19:33:18 UTC (rev 9816)
@@ -104,7 +104,6 @@
<form id="frm_update_check_list"
action="index.php?menuaction=controller.uicheck_list.save_check_list"
method="post">
<xsl:variable name="check_list_id"><xsl:value-of
select="check_list/id"/></xsl:variable>
<input id="check_list_id" type="hidden"
name="check_list_id" value="{$check_list_id}" />
- <input type="hidden" name="phpgw_return_as"
value="json" />
<fieldset class="col_1">
<div class="row">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9816],
Torstein <=