fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7924]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7924]
Date: Mon, 24 Oct 2011 07:04:42 +0000

Revision: 7924
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7924
Author:   erikhl
Date:     2011-10-24 07:04:30 +0000 (Mon, 24 Oct 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.soprocedure.inc.php
    trunk/controller/inc/class.uiprocedure.inc.php
    trunk/controller/inc/model/class.procedure.inc.php
    trunk/controller/setup/phpgw_no.lang
    trunk/controller/setup/setup.inc.php
    trunk/controller/setup/tables_current.inc.php
    trunk/controller/setup/tables_update.inc.php
    trunk/controller/templates/base/procedure_item.xsl

Modified: trunk/controller/inc/class.soprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.soprocedure.inc.php      2011-10-24 06:20:26 UTC 
(rev 7923)
+++ trunk/controller/inc/class.soprocedure.inc.php      2011-10-24 07:04:30 UTC 
(rev 7924)
@@ -36,7 +36,10 @@
                                'reference',
                                'attachment',
                                'start_date',
-                               'end_date'
+                               'end_date',
+                               'procedure_id',
+                               'revision_no',
+                               'revision_date'
                );
                        
                $values = array(
@@ -47,7 +50,10 @@
                        $this->marshal($procedure->get_reference(), 'string'),
                        $this->marshal($procedure->get_attachment(), 'string'),
                        $this->marshal($procedure->get_start_date(), 'int'),
-                       $this->marshal($procedure->get_end_date(), 'int')
+                       $this->marshal($procedure->get_end_date(), 'int'),
+                       $this->marshal($procedure->get_procedure_id(), 'int'),
+                       $this->marshal($procedure->get_revision_no(), 'int'),
+                       $this->marshal($procedure->get_revision_date(), 'int')
                );
                
                $result = $this->db->query('INSERT INTO controller_procedure (' 
. join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
@@ -82,7 +88,10 @@
                        'reference = ' . 
$this->marshal($procedure->get_reference(), 'string'),
                        'attachment = ' . 
$this->marshal($procedure->get_attachment(), 'string'),
                        'start_date = ' . 
$this->marshal($procedure->get_start_date(), 'int'),
-                       'end_date = ' . 
$this->marshal($procedure->get_end_date(), 'int')
+                       'end_date = ' . 
$this->marshal($procedure->get_end_date(), 'int'),
+                       'procedure_id = ' . 
$this->marshal($procedure->get_procedure_id(), 'int'),
+                       'revision_no = ' . 
$this->marshal($procedure->get_revision_no(), 'int'),
+                       'revision_date = ' . 
$this->marshal($procedure->get_revision_date(), 'int')
                );
                
                $result = $this->db->query('UPDATE controller_procedure SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
@@ -113,6 +122,9 @@
                
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
                
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
                
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+               
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
+               
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
+               
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'), 
'int'));
                
                return $procedure;
        }
@@ -138,6 +150,9 @@
                        
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
                        
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
                        
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+                       
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
+                       
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
+                       
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'), 
'int'));
                        
                        $results[] = $procedure;
                }
@@ -166,6 +181,9 @@
                        
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
                        
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
                        
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+                       
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
+                       
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
+                       
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'), 
'int'));
                        
                        $results[] = $procedure->toArray();;
                }
@@ -324,7 +342,7 @@
                }
                else
                {
-                       $cols .= "controller_procedure.id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.responsibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment, 
controller_procedure.start_date, controller_procedure.end_date ";
+                       $cols .= "controller_procedure.id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.responsibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment, 
controller_procedure.start_date, controller_procedure.end_date, 
controller_procedure.procedure_id, controller_procedure.revision_no, 
controller_procedure.revision_date ";
                }
                $dir = $ascending ? 'ASC' : 'DESC';
                $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';
@@ -348,6 +366,9 @@
                        
$procedure->set_attachment($this->unmarshal($this->db->f('attachment'), 
'string'));
                        
$procedure->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
                        
$procedure->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+                       
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
+                       
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
+                       
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'), 
'int'));
                }
                
                return $procedure;

Modified: trunk/controller/inc/class.uiprocedure.inc.php
===================================================================
--- trunk/controller/inc/class.uiprocedure.inc.php      2011-10-24 06:20:26 UTC 
(rev 7923)
+++ trunk/controller/inc/class.uiprocedure.inc.php      2011-10-24 07:04:30 UTC 
(rev 7924)
@@ -141,6 +141,49 @@
                                        
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'controller.uiprocedure.view', 'id' => $proc_id));
                                }
                        }
+                       else if(isset($_POST['revisit_procedure'])) // The user 
has pressed the revisit button
+                       {
+                               $old_procedure = 
$this->so->get_single($procedure_id);
+                               if(isset($procedure)) // Edit procedure
+                               {
+                                       $revision = 
$procedure->get_revision_no();
+                                       if($revision && is_numeric($revision))
+                                       {
+                                               $revision = (int)$revision;
+                                               $new_revision = $revision++;
+                                               
$procedure->set_revision_no($new_revision);
+                                       }
+                                       
$procedure->set_title(phpgw::get_var('title'));
+                                       
$procedure->set_purpose(phpgw::get_var('purpose','html'));
+                                       
$procedure->set_responsibility(phpgw::get_var('responsibility'));
+                                       
$procedure->set_description(phpgw::get_var('description','html'));
+                                       
$procedure->set_reference(phpgw::get_var('reference'));
+                                       
$procedure->set_attachment(phpgw::get_var('attachment'));
+                                       
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
+                                       
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
+                                       
+                                       if(isset($procedure_id) && 
$procedure_id > 0)
+                                       {
+                                               $proc_id = $procedure_id;
+                                               $old_procedure->set_id(null);
+                                               
$old_procedure->set_end_date(time());
+                                               
$old_procedure->set_procedure_id($proc_id);
+                                               
if($this->so->add($old_procedure)) //add old revision of procedure to history
+                                               {
+                                                       
if($this->so->store($procedure))
+                                                       {
+                                                               $message = 
lang('messages_saved_form');
+                                                       }
+                                                       else
+                                                       {
+                                                               $error = 
lang('messages_form_error');
+                                                       }
+                                               }
+                                       }
+
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'controller.uiprocedure.view', 'id' => $proc_id));
+                               }
+                       }
                        else if(isset($_POST['cancel_procedure'])) // The user 
has pressed the cancel button
                        {
                                if(isset($procedure_id) && $procedure_id > 0)

Modified: trunk/controller/inc/model/class.procedure.inc.php
===================================================================
--- trunk/controller/inc/model/class.procedure.inc.php  2011-10-24 06:20:26 UTC 
(rev 7923)
+++ trunk/controller/inc/model/class.procedure.inc.php  2011-10-24 07:04:30 UTC 
(rev 7924)
@@ -14,6 +14,9 @@
                protected $attachment;
                protected $start_date;
                protected $end_date;
+               protected $procedure_id;
+               protected $revision_no;
+               protected $revision_date;
                
                /**
                 * Constructor.  Takes an optional ID.  If a procedure is 
created from outside
@@ -89,6 +92,27 @@
                
                public function get_end_date() { return $this->end_date; }
                
+               public function set_procedure_id($procedure_id)
+               {
+                       $this->procedure_id = $procedure_id;
+               }
+               
+               public function get_procedure_id() { return 
$this->procedure_id; }
+               
+               public function set_revision_no($revision_no)
+               {
+                       $this->revision_no = $revision_no;
+               }
+               
+               public function get_revision_no() { return $this->revision_no; }
+               
+               public function set_revision_date($revision_date)
+               {
+                       $this->revision_date = $revision_date;
+               }
+               
+               public function get_revision_date() { return 
$this->revision_date; }
+               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 
@@ -114,7 +138,10 @@
                                        'reference' => $this->get_reference(),
                                        'attachment' => $this->get_attachment(),
                                        'start_date' => $this->get_start_date(),
-                                       'end_date' => $this->get_end_date()
+                                       'end_date' => $this->get_end_date(),
+                                       'procedure_id' => 
$this->get_procedure_id(),
+                                       'revision_no' => 
$this->get_revision_no(),
+                                       'revision_date' => 
$this->get_revision_date()
                        );
                }
        }

Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang        2011-10-24 06:20:26 UTC (rev 
7923)
+++ trunk/controller/setup/phpgw_no.lang        2011-10-24 07:04:30 UTC (rev 
7924)
@@ -255,4 +255,5 @@
 Equipment      controller      no      Utstyr
 Control_locations      controller      no      Lokasjoner
 Control_equipment      controller      no      Utstyr
-New control    controller      no      Ny kontroll
\ No newline at end of file
+New control    controller      no      Ny kontroll
+revisit        controller      no      Revidér
\ No newline at end of file

Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php        2011-10-24 06:20:26 UTC (rev 
7923)
+++ trunk/controller/setup/setup.inc.php        2011-10-24 07:04:30 UTC (rev 
7924)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1';
+       $setup_info['controller']['version'] = '0.1.1';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php       2011-10-24 06:20:26 UTC 
(rev 7923)
+++ trunk/controller/setup/tables_current.inc.php       2011-10-24 07:04:30 UTC 
(rev 7924)
@@ -88,7 +88,10 @@
                                'reference' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True),
                                'attachment' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True),
                                'start_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
-                               'end_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True)
+                               'end_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
+                               'procedure_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'revision_no' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'revision_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php        2011-10-24 06:20:26 UTC 
(rev 7923)
+++ trunk/controller/setup/tables_update.inc.php        2011-10-24 07:04:30 UTC 
(rev 7924)
@@ -6,28 +6,24 @@
        $test[] = '0.1';
        function controller_upgrade0_1()
        {
-               $GLOBALS['phpgw_setup']->oProc->CreateTable(
-                       'activity_organization', array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
-                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
-                               'district' => array('type' => 
'varchar','precision' => '255','nullable' => false),
-                               'homepage' => array('type' => 
'varchar','precision' => '255','nullable' => false),
-                               'description' => array('type' => 
'text','nullable' => false),
-                               'email' => array('type' => 
'varchar','precision' => '255','nullable' => false),
-                               'phone' => array('type' => 
'varchar','precision' => '255','nullable' => false),
-                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => false),
-                               'orgno' => array('type' => 
'varchar','precision' => '255','nullable' => false),
-                               'change_type' => array('type' => 
'varchar','precision' => '255','default' => 'new','nullable' => false),
-                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-                       )
-               );
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_procedure','procedure_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+               ));
                
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_procedure','revision_no',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+               ));
+               
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_procedure','revision_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => True
+               ));
+               
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.1';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }

Modified: trunk/controller/templates/base/procedure_item.xsl
===================================================================
--- trunk/controller/templates/base/procedure_item.xsl  2011-10-24 06:20:26 UTC 
(rev 7923)
+++ trunk/controller/templates/base/procedure_item.xsl  2011-10-24 07:04:30 UTC 
(rev 7924)
@@ -111,8 +111,10 @@
                                        <xsl:choose>
                                                <xsl:when test="editable">
                                                        <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
+                                                       <xsl:variable 
name="lang_revisit"><xsl:value-of select="php:function('lang', 'revisit')" 
/></xsl:variable>
                                                        <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
                                                        <input type="submit" 
name="save_procedure" value="{$lang_save}" title = "{$lang_save}" />
+                                                       <input type="submit" 
name="revisit_procedure" value="{$lang_revisit}" title = "{$lang_revisit}" />
                                                        <input type="submit" 
name="cancel_procedure" value="{$lang_cancel}" title = "{$lang_cancel}" />
                                                </xsl:when>
                                                <xsl:otherwise>




reply via email to

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