fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8827]


From: Torstein
Subject: [Fmsystem-commits] [8827]
Date: Thu, 09 Feb 2012 18:11:33 +0000

Revision: 8827
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8827
Author:   vator
Date:     2012-02-09 18:11:33 +0000 (Thu, 09 Feb 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socase.inc.php
    trunk/controller/inc/class.uicase.inc.php
    trunk/controller/js/controller/ajax.js
    trunk/controller/templates/base/check_list/register_case.xsl

Modified: trunk/controller/inc/class.socase.inc.php
===================================================================
--- trunk/controller/inc/class.socase.inc.php   2012-02-09 13:37:08 UTC (rev 
8826)
+++ trunk/controller/inc/class.socase.inc.php   2012-02-09 18:11:33 UTC (rev 
8827)
@@ -121,6 +121,7 @@
                                        'entry_date',
                                        'modified_date',
                                        'modified_by',
+                                       'measurement',
                        );
 
                        $values = array(
@@ -132,7 +133,8 @@
                                $this->marshal($case->get_user_id(), 'int'),
                                $this->marshal($case->get_entry_date(), 'int'),
                                $this->marshal($case->get_modified_date(), 
'int'),
-                               $this->marshal($case->get_modified_by(), 'int')
+                               $this->marshal($case->get_modified_by(), 'int'),
+                               $this->marshal($case->get_measurement(), 'int')
                        );
 
                        $result = $this->db->query('INSERT INTO 
controller_check_item_case (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
@@ -154,6 +156,7 @@
                                'entry_date = ' . 
$this->marshal($case->get_entry_date(), 'int'),
                                'modified_date = ' . 
$this->marshal($case->get_modified_date(), 'int'),
                                'modified_by = ' . 
$this->marshal($case->get_modified_by(), 'int'),
+                               'measurement = ' . 
$this->marshal($case->get_measurement(), 'int')
                        );
 
                        $result = $this->db->query('UPDATE 
controller_check_item_case SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);

Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php   2012-02-09 13:37:08 UTC (rev 
8826)
+++ trunk/controller/inc/class.uicase.inc.php   2012-02-09 18:11:33 UTC (rev 
8827)
@@ -68,14 +68,17 @@
                        $check_list_id = phpgw::get_var('check_list_id');
                        $control_item_id = phpgw::get_var('control_item_id');
                        $case_descr = phpgw::get_var('case_descr');
-                                                                               
        
+                       $type = phpgw::get_var('type');
+                       $measurement = phpgw::get_var('measurement');
+                       $status = phpgw::get_var('status');
+                        
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
                                                
                        $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );
                        
                        $check_item = 
$this->so_check_item->get_check_item_by_check_list_and_control_item($check_list_id,
 $control_item_id);
-                       
+                                               
                        /*
                        
                        $db_check_item = $this->so_check_item->get_db();
@@ -90,7 +93,10 @@
                                $new_check_item = new controller_check_item();
                                $new_check_item->set_check_list_id( 
$check_list_id );
                                $new_check_item->set_control_item_id( 
$control_item_id );
-                               $new_check_item->set_status( 0 );
+                               if($status == 0)
+                                       $new_check_item->set_status( 0 );
+                               else
+                                       $new_check_item->set_status( 1 );
                                $new_check_item->set_comment( null );
                                
                                $saved_check_item_id = 
$this->so_check_item->store( $new_check_item );
@@ -100,16 +106,17 @@
                        $todays_date = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
 
                        $user_id = $GLOBALS['phpgw_info']['user']['id'];
-                       $case_status = 0;
-                       
+                                               
                        $case = new controller_check_item_case();
                        $case->set_check_item_id( $check_item->get_id() );
-                       $case->set_status($case_status);
                        $case->set_descr($case_descr);
                        $case->set_user_id($user_id);
                        $case->set_entry_date($todays_date);
                        $case->set_modified_date($todays_date);
                        $case->set_modified_by($user_id);
+                       $case->set_modified_by($user_id);
+                       $case->set_measurement($measurement);
+                       $case->set_status($status);
                                
                        $case_id = $this->so->store($case);
                        
@@ -123,48 +130,6 @@
                                return json_encode( array( "status" => 
"not_saved" ) ); 
                }
                
-               function register_measurement_case(){
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       $control_item_id = phpgw::get_var('control_item_id');
-                       $case_descr = phpgw::get_var('case_descr');
-                       $measurement = phpgw::get_var('measurement');
-                       $status = (int)phpgw::get_var('status');
-                                                                               
        
-                       $check_list = 
$this->so_check_list->get_single($check_list_id);
-                                               
-                       $control_id = $check_list->get_control_id();
-                       $control = $this->so_control->get_single( $control_id );
-                       
-                       /*
-                       
-                       $db_check_item = $this->so_check_item->get_db();
-                       $db_check_item->transaction_begin();
-
-                       $db_check_item->transaction_commit();
-                       $db_check_item->transaction_abort();
-                       
-                       */
-       
-                       $new_check_item = new controller_check_item();
-                       $new_check_item->set_check_list_id( $check_list_id );
-                       $new_check_item->set_control_item_id( $control_item_id 
);
-                       $new_check_item->set_status( $status );
-                       $new_check_item->set_comment($case_descr);
-                       $new_check_item->set_measurement($measurement);
-
-                       $saved_check_item_id = 0;
-                       $saved_check_item_id = $this->so_check_item->store( 
$new_check_item );
-
-                       if($saved_check_item_id > 0){
-                               $status_checker = new status_checker();
-                               $status_checker->update_check_list_status( 
$check_list_id );
-                                               
-                               return json_encode( array( "status" => "saved" 
) );
-                       }
-                       else
-                               return json_encode( array( "status" => 
"not_saved" ) ); 
-               }
-               
                function create_case_message(){
                        $check_list_id = phpgw::get_var('check_list_id');
                        $check_list = 
$this->so_check_list->get_single($check_list_id);

Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2012-02-09 13:37:08 UTC (rev 
8826)
+++ trunk/controller/js/controller/ajax.js      2012-02-09 18:11:33 UTC (rev 
8827)
@@ -422,28 +422,15 @@
                          url: requestUrl + "&" + $(thisForm).serialize(),
                          success: function(data) {
                                  if(data){
-                                 var obj = jQuery.parseJSON(data);
+                                 var jsonObj = jQuery.parseJSON(data);
                                
-                                 if(obj.status == "saved"){
+                                 if(jsonObj.status == "saved"){
                                          var submitBnt = 
$(thisForm).find("input[type='submit']");
                                          $(submitBnt).val("Lagret");   
                                          
-                                         
$(thisForm).find(':input').each(function() {
-                                               switch(this.type) {
-                                                   case 'password':
-                                                   case 'select-multiple':
-                                                   case 'select-one':
-                                                   case 'text':
-                                                       $(this).val('');
-                                                       break;
-                                                   case 'textarea':
-                                                       $(this).val('');
-                                                       break;
-                                                   case 'checkbox':
-                                                   case 'radio':
-                                                       this.checked = false;
-                                               }
-                                           });
+                                         clear_form( thisForm );
+                                         
+                                        
                                                  
                                          // Changes text on save button back 
to original
                                          window.setTimeout(function() {
@@ -456,35 +443,6 @@
                });
        });
        
-       $(".frm_register_measurement_case").live("submit", function(e){
-               e.preventDefault();
-
-               var thisForm = $(this);
-               var thisRow = $(this).parents("li");
-               var submitBnt = $(thisForm).find("input[type='submit']");
-               var requestUrl = $(thisForm).attr("action");
-               
-               $.ajax({
-                         type: 'POST',
-                         url: requestUrl + "&" + $(thisForm).serialize(),
-                         success: function(data) {
-                                 if(data){
-                                 var obj = jQuery.parseJSON(data);
-                               
-                                 if(obj.status == "saved"){
-                                         var submitBnt = 
$(thisForm).find("input[type='submit']");
-                                         $(submitBnt).val("Lagret");
-                                         
-                                         // Changes text on save button back 
to original
-                                         window.setTimeout(function() {
-                                                       $(thisRow).remove();
-                                         }, 1000);
-                                         }
-                                 }
-                               }
-               });
-       });
-       
        // Delete a case item from list
        $(".delete_case").live("click", function(){
                var clickElem = $(this);
@@ -557,7 +515,26 @@
        });
 });
 
+function clear_form( form ){
+        // Clear form
+         $(form).find(':input').each(function() {
+               switch(this.type) {
+                   case 'select-multiple':
+                   case 'select-one':
+                   case 'text':
+                       $(this).val('');
+                       break;
+                   case 'textarea':
+                       $(this).val('');
+                       break;
+                   case 'checkbox':
+                   case 'radio':
+                       this.checked = false;
+               }
+           });
+}
 
+
 //Updates order number for hidden field and number in front of row
 function update_order_nr_for_row(element, sign){
        

Modified: trunk/controller/templates/base/check_list/register_case.xsl
===================================================================
--- trunk/controller/templates/base/check_list/register_case.xsl        
2012-02-09 13:37:08 UTC (rev 8826)
+++ trunk/controller/templates/base/check_list/register_case.xsl        
2012-02-09 18:11:33 UTC (rev 8827)
@@ -46,11 +46,10 @@
                                                                        </form>
                                                                </xsl:when>
                                                                <xsl:when 
test="type = 'control_item_type_2'">
-                                                               <form 
class="frm_register_measurement_case" 
action="index.php?menuaction=controller.uicase.register_measurement_case&amp;phpgw_return_as=json"
 method="post">
+                                                               <form 
class="frm_register_case" 
action="index.php?menuaction=controller.uicase.register_case&amp;phpgw_return_as=json"
 method="post">
                                                                        
<xsl:variable name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
                                                                                
<input type="hidden" name="control_item_id" value="{$control_item_id}" /> 
                                                                                
<input name="check_list_id" type="hidden"><xsl:attribute 
name="value"><xsl:value-of select="//check_list/id"/></xsl:attribute></input>
-                                                                           
<input name="status" type="hidden" value="0" />
                                                                                
<input name="type" type="hidden" value="control_item_type_2" />
                                                                
                                                                        <div 
class="check_item">




reply via email to

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