fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14977]


From: Nelson Guerra
Subject: [Fmsystem-commits] [14977]
Date: Thu, 05 May 2016 23:31:59 +0000

Revision: 14977
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14977
Author:   nelson224
Date:     2016-05-05 23:31:59 +0000 (Thu, 05 May 2016)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/property/inc/class.bogeneric_document.inc.php

Modified: 
branches/dev-syncromind-2/property/inc/class.bogeneric_document.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.bogeneric_document.inc.php     
2016-05-05 23:31:11 UTC (rev 14976)
+++ branches/dev-syncromind-2/property/inc/class.bogeneric_document.inc.php     
2016-05-05 23:31:59 UTC (rev 14977)
@@ -29,7 +29,16 @@
 
        class property_bogeneric_document
        {
-
+               private $so;
+               var $public_functions = array
+                       (
+                       'read' => true,
+                       'read_single' => true,
+                       'save' => true,
+                       'delete' => true,
+                       'get_file_relations' => true
+               );
+               
                public function __construct()
                {
                        $this->so = CreateObject('property.sogeneric_document');
@@ -44,11 +53,11 @@
                        return $values;
                }
                
-               function read_single( $file_id )
+               public function read_single( $file_id )
                {
                        $values = $this->so->read_single($file_id);
 
-                       return $values;
+                       return json_decode($values);
                }
 
                function get_file_relations( $location_id, $file_id )
@@ -57,4 +66,24 @@
 
                        return $values;
                }
+               
+               function save( $values = array(), $file_id )
+               {
+                       $report_date = 
phpgwapi_datetime::date_array($values['report_date']);
+                       $values['report_date'] = mktime(2, 0, 0, 
$report_date['month'], $report_date['day'], $report_date['year']);
+                       
+                       $result = $this->so->read_single( $file_id );
+
+                       if (count($result))
+                       {
+                               $receipt = $this->so->edit($values, $file_id);
+                       }
+                       else
+                       {
+                               $receipt = $this->so->add($values, $file_id);
+                       }
+                       
+                       return $receipt;
+               }
+               
        }
\ No newline at end of file




reply via email to

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