fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16960] Stable: Merge 16954:16959 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [16960] Stable: Merge 16954:16959 from trunk
Date: Wed, 9 Aug 2017 05:37:21 -0400 (EDT)

Revision: 16960
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16960
Author:   sigurdne
Date:     2017-08-09 05:37:20 -0400 (Wed, 09 Aug 2017)
Log Message:
-----------
Stable: Merge 16954:16959 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/controller/inc/class.socommon.inc.php
    branches/Version-2_0-branch/controller/inc/class.soprocedure.inc.php
    branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php
    
branches/Version-2_0-branch/controller/templates/base/check_list/print_check_list.xsl
    
branches/Version-2_0-branch/controller/templates/base/check_list/view_control_info.xsl
    
branches/Version-2_0-branch/controller/templates/base/procedure/print_procedure.xsl
    
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
    branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.xslttemplates.inc.php

Property Changed:
----------------
    branches/Version-2_0-branch/

Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-08-09 09:35:54 UTC (rev 16959)
+++ branches/Version-2_0-branch 2017-08-09 09:37:20 UTC (rev 16960)

Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
 /branches/dev-syncromind:13653
 /branches/dev-syncromind-2:14933-16846
 /branches/stavangerkommune:12743-12875,12986
-/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833,16835-16836,16838,16840-16844,16846-16847,16849,16851,16853-16854,16856-16859,16861,16863-16865,16867,16869-16871,16873,16875-16876,16878,16880-16881,16883,16885,16887-16888,16890,16892,16894-16900,16902,16904,16906,16908-16909,16911-16916,16918-16919,16921,16923,16925,16927,16929-16930,16932,16934,16936-16937,16939-16942,16944,16946,16948,16950,16952-16953
\ No newline at end of property
+/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833,16835-16836,16838,16840-16844,16846-16847,16849,16851,16853-16854,16856-16859,16861,16863-16865,16867,16869-16871,16873,16875-16876,16878,16880-16881,16883,16885,16887-16888,16890,16892,16894-16900,16902,16904,16906,16908-16909,16911-16916,16918-16919,16921,16923,16925,16927,16929-16930,16932,16934,16936-16937,16939-16942,16944,16946,16948,16950,16952-16953,16955-16959
\ No newline at end of property
Modified: branches/Version-2_0-branch/controller/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.socommon.inc.php   
2017-08-09 09:35:54 UTC (rev 16959)
+++ branches/Version-2_0-branch/controller/inc/class.socommon.inc.php   
2017-08-09 09:37:20 UTC (rev 16960)
@@ -45,6 +45,36 @@
                }
 
                /**
+                * Begin transaction
+                *
+                * @return integer|bool current transaction id
+                */
+               public function transaction_begin()
+               {
+                       return $this->db->transaction_begin();
+               }
+
+               /**
+                * Complete the transaction
+                *
+                * @return bool True if sucessful, False if fails
+                */
+               public function transaction_commit()
+               {
+                       return $this->db->transaction_commit();
+               }
+
+               /**
+                * Rollback the current transaction
+                *
+                * @return bool True if sucessful, False if fails
+                */
+               public function transaction_abort()
+               {
+                       return $this->db->transaction_abort();
+               }
+
+               /**
                 * Marshal values according to type
                 * @param $value the value
                 * @param $type the type of value

Modified: branches/Version-2_0-branch/controller/inc/class.soprocedure.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.soprocedure.inc.php        
2017-08-09 09:35:54 UTC (rev 16959)
+++ branches/Version-2_0-branch/controller/inc/class.soprocedure.inc.php        
2017-08-09 09:37:20 UTC (rev 16960)
@@ -37,6 +37,7 @@
        {
 
                protected static $so;
+               private $other_revisions = array(-1);
 
                /**
                 * Get a static reference to the storage object associated with 
this model object
@@ -190,15 +191,71 @@
                        return $procedure;
                }
 
-               function get_single_with_documents( $id, $return_type = 
"return_object" )
+               function get_procedure_version( $procedure_id, 
$valid_version_date)
                {
-                       $id = (int)$id;
+                       $sql = "SELECT id, procedure_id, start_date, end_date 
FROM controller_procedure"
+                               . " WHERE id = {$procedure_id}";
 
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $new_version_id = (int)$this->db->f('procedure_id');
+                       $start_date = (int)$this->db->f('start_date');
+                       $end_date = (int)$this->db->f('end_date');
+
+                       if( $valid_version_date > $start_date && 
($valid_version_date < $end_date || !$end_date))
+                       {
+                               $ret = $procedure_id;
+                       }
+                       else if($new_version_id && $valid_version_date > 
$end_date)
+                       {
+                               $ret = 
$this->get_procedure_version($new_version_id, $valid_version_date);
+                       }
+                       else
+                       {
+                               $ret = $procedure_id;
+                       }
+
+                       return $ret;
+
+               }
+
+
+               function get_valid_version_date($check_list_id)
+               {
+                       $sql = "SELECT completed_date FROM 
controller_check_list"
+                               . " {$this->join} controller_control ON 
controller_control.id = controller_check_list.control_id"
+                               . " WHERE controller_check_list.id= " . (int) 
$check_list_id;
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $completed_date = $this->db->f('completed_date');
+                       $valid_version_date = $completed_date ? $completed_date 
: time();
+
+                       return $valid_version_date;
+
+               }
+
+               function get_single_no_documents($procedure_id, $check_list_id )
+               {
+                       $valid_version_date = 
$this->get_valid_version_date($check_list_id);
+
+                       $procedure_id = 
$this->get_procedure_version((int)$procedure_id, $valid_version_date);
+
+                       return $this->get_single($procedure_id);
+               }
+
+               function get_single_with_documents($procedure_id, 
$check_list_id, $return_type = "return_object" )
+               {
+                       $valid_version_date = 
$this->get_valid_version_date($check_list_id);
+
+                       $procedure_id = 
$this->get_procedure_version((int)$procedure_id, $valid_version_date);
+
                        $counter = 0;
                        $documents = null;
 
-                       $joins .= " {$this->left_join} controller_document ON 
(p.id = controller_document.procedure_id)";
-                       $sql = "SELECT p.*, controller_document.id AS 
document_id, controller_document.title AS document_title, 
controller_document.description as document_description FROM 
controller_procedure p {$joins} WHERE p.id = " . $id;
+                       $sql = "SELECT p.*, controller_document.id AS 
document_id, controller_document.title AS document_title,"
+                               . " controller_document.description as 
document_description FROM controller_procedure p"
+                               . " {$this->left_join} controller_document ON 
(p.id = controller_document.procedure_id)"
+                               . " WHERE p.id = {$procedure_id}";
                        //var_dump($sql);
                        $this->db->query($sql, __LINE__, __FILE__);
                        while ($this->db->next_record())
@@ -270,6 +327,7 @@
                        $cat_id = (int)$control_area_id;
                        $cats = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
                        $cat_path = $cats->get_path($cat_id);
+                       $cat_filter = array(-1);
                        foreach ($cat_path as $_category)
                        {
                                $cat_filter[] = $_category['id'];
@@ -277,9 +335,25 @@
 
                        $filter_control_area = 
"controller_procedure.control_area_id IN (" . implode(',', $cat_filter) . ')';
 
+                       $procedure_ids = array(-1);
+
+                       $sql = "SELECT procedure_id FROM controller_procedure"
+                               . " WHERE procedure_id IS NOT NULL";
+                       $this->db->query($sql);
+
+                       while ($this->db->next_record())
+                       {
+                               $procedure_ids[] = $this->db->f('procedure_id');
+
+                       }
+                       $filter_procedure = "AND controller_procedure.id NOT IN 
(" . implode(',', $procedure_ids) . ')';
+
                        $results = array();
 
-                       $sql = "SELECT * FROM controller_procedure WHERE 
{$filter_control_area} AND end_date IS NULL ORDER BY title ASC";
+                       $sql = "SELECT * FROM controller_procedure"
+                               . " WHERE {$filter_control_area}"
+                               . " AND (end_date IS NULL OR procedure_id IS 
NOT NULL)"
+                               . " {$filter_procedure} ORDER BY title ASC";
                        $this->db->query($sql);
 
                        while ($this->db->next_record())
@@ -401,12 +475,46 @@
                        return $results;
                }
 
-               function get_old_revisions( $id )
+
+
+               private function _get_other_revisions( $procedure_id, 
$direction = 'up')
                {
+                       $procedure_id = (int) $procedure_id;
+
+                       if($direction == 'up') //older
+                       {
+                               $sql = "SELECT id AS other_version_id FROM 
controller_procedure"
+                               . " WHERE procedure_id = {$procedure_id}";
+                       }
+                       else // newer
+                       {
+                               $sql = "SELECT procedure_id AS other_version_id 
FROM controller_procedure"
+                               . " WHERE id = {$procedure_id}";
+                       }
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->db->next_record();
+                       $other_version_id = 
(int)$this->db->f('other_version_id');
+                       $this->other_revisions[] = $other_version_id;
+
+                       if($other_version_id)
+                       {
+                               $this->_get_other_revisions($other_version_id, 
$direction);
+                       }
+               }
+
+
+               function get_other_revisions( $id )
+               {
                        $id = (int)$id;
+
+                       $this->_get_other_revisions( $id, 'up');
+                       $this->_get_other_revisions( $id, 'down');
+
+                       $revision_filter = 'id IN(' . implode(',', 
$this->other_revisions) . ')';
+
                        $results = array();
 
-                       $sql = "SELECT p.* FROM controller_procedure p WHERE 
procedure_id = {$id} ORDER BY end_date DESC";
+                       $sql = "SELECT p.* FROM controller_procedure p WHERE 
{$revision_filter} ORDER BY end_date ASC";
                        $this->db->query($sql, __LINE__, __FILE__);
 
                        while ($this->db->next_record())

Modified: branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php        
2017-08-09 09:35:54 UTC (rev 16959)
+++ branches/Version-2_0-branch/controller/inc/class.uiprocedure.inc.php        
2017-08-09 09:37:20 UTC (rev 16960)
@@ -184,7 +184,7 @@
 
                public function edit()
                {
-                       $procedure_id = phpgw::get_var('id');
+                       $procedure_id = phpgw::get_var('id', 'int');
                        if (isset($procedure_id) && $procedure_id > 0)
                        {
                                $procedure = 
$this->so->get_single($procedure_id);
@@ -197,9 +197,6 @@
 
                        if (isset($_POST['save_procedure'])) // The user has 
pressed the save button
                        {
-                               //var_dump($_POST);
-                               
//var_dump(strtotime(phpgw::get_var('start_date')));
-                               //die;
                                if (!$this->add && !$this->edit)
                                {
                                        phpgwapi_cache::message_set('No 
access', 'error');
@@ -223,9 +220,9 @@
                                        
$procedure->set_description($description_txt);
                                        
$procedure->set_reference($reference_txt);
                                        
$procedure->set_attachment(phpgw::get_var('attachment'));
-                                       
$procedure->set_start_date(strtotime(phpgw::get_var('start_date')));
-                                       
$procedure->set_end_date(strtotime(phpgw::get_var('end_date')));
-                                       
$procedure->set_revision_date(strtotime(phpgw::get_var('revision_date')));
+                                       
$procedure->set_start_date(phpgw::get_var('start_date', 'date'));
+                                       
$procedure->set_end_date(phpgw::get_var('end_date', 'date'));
+                                       
$procedure->set_revision_date(phpgw::get_var('revision_date', 'date'));
                                        
$procedure->set_control_area_id(phpgw::get_var('control_area'));
 
                                        $revision = 
(int)$procedure->get_revision_no();
@@ -275,53 +272,68 @@
                                                'id' => $procedure_id));
                                }
 
+                               //Sigurd 20170808: we are keeping the old one 
as reference as is, and creating a new one for future checklists
                                $old_procedure = 
$this->so->get_single($procedure_id);
                                if (isset($procedure)) // Edit procedure
                                {
+
+                                       $description_txt = 
phpgw::get_var('description', 'html');
+                                       $description_txt = 
str_replace("&nbsp;", " ", $description_txt);
+                                       $purpose_txt = 
phpgw::get_var('purpose', 'html');
+                                       $purpose_txt = str_replace("&nbsp;", " 
", $purpose_txt);
+                                       $reference_txt = 
phpgw::get_var('reference', 'html');
+                                       $reference_txt = str_replace("&nbsp;", 
" ", $reference_txt);
+
+                                       $new_procedure = new 
controller_procedure();
                                        $revision = 
(int)$procedure->get_revision_no();
                                        if ($revision && is_numeric($revision))
                                        {
                                                $revision++;
-                                               
$procedure->set_revision_no($revision);
+                                               
$new_procedure->set_revision_no($revision);
                                        }
                                        else
                                        {
-                                               $procedure->set_revision_no(2);
+                                               
$new_procedure->set_revision_no(2);
                                        }
+                                       
$new_procedure->set_title(phpgw::get_var('title'));
+                                       
$new_procedure->set_purpose($purpose_txt);
+                                       
$new_procedure->set_responsibility(phpgw::get_var('responsibility'));
+                                       
$new_procedure->set_description($description_txt);
+                                       
$new_procedure->set_reference($reference_txt);
+                                       
$new_procedure->set_attachment(phpgw::get_var('attachment'));
 
-                                       $description_txt = 
phpgw::get_var('description', 'html');
-                                       $description_txt = 
str_replace("&nbsp;", " ", $description_txt);
-                                       $purpose_txt = 
phpgw::get_var('purpose', 'html');
-                                       $purpose_txt = str_replace("&nbsp;", " 
", $purpose_txt);
-                                       $reference_txt = 
phpgw::get_var('reference', 'html');
-                                       $reference_txt = str_replace("&nbsp;", 
" ", $reference_txt);
-                                       
$procedure->set_title(phpgw::get_var('title'));
-                                       $procedure->set_purpose($purpose_txt);
-                                       
$procedure->set_responsibility(phpgw::get_var('responsibility'));
-                                       
$procedure->set_description($description_txt);
-                                       
$procedure->set_reference($reference_txt);
-                                       
$procedure->set_attachment(phpgw::get_var('attachment'));
-                                       
$procedure->set_start_date(strtotime(phpgw::get_var('start_date')));
-                                       
$procedure->set_end_date(strtotime(phpgw::get_var('end_date')));
-                                       
$procedure->set_control_area_id(phpgw::get_var('control_area'));
+                                       $start_date = 
phpgw::get_var('start_date', 'date');
+                                       $start_date = $start_date ? $start_date 
: time();
+                                       
$new_procedure->set_start_date($start_date);
 
+                                       
$new_procedure->set_end_date(phpgw::get_var('end_date', 'date'));
+
+                                       $revision_date = 
phpgw::get_var('revision_date', 'date');
+                                       $revision_date = $revision_date ? 
$revision_date : time();
+                                       
$new_procedure->set_revision_date($revision_date);
+
+                                       
$new_procedure->set_control_area_id(phpgw::get_var('control_area'));
+
                                        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
+                                               $this->so->transaction_begin();
+                                               if ($proc_id = 
$this->so->add($new_procedure)) //add the revised prosedure as new
                                                {
-                                                       if 
($this->so->store($procedure))
+                                                       $old_end_date = 
$start_date ? $start_date : time();
+                                                       
$old_procedure->set_end_date($old_end_date);
+                                                       
$old_procedure->set_revision_date($revision_date);
+                                                       
$old_procedure->set_procedure_id($proc_id);
+                                                       if 
($this->so->store($old_procedure)) //add revision of the old procedure to 
history
                                                        {
                                                                $message = 
lang('messages_saved_form');
                                                        }
                                                        else
                                                        {
+                                                               
$this->so->transaction_abort();
                                                                $error = 
lang('messages_form_error');
                                                        }
                                                }
+                                               $this->so->transaction_commit();
                                        }
 
                                        
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'controller.uiprocedure.view',
@@ -543,7 +555,7 @@
                                }
                                $procedure_array = $procedure->toArray();
 
-                               if (!$view_revision)
+//                             if (!$view_revision)
                                {
                                        $table_header[] = array('header' => 
lang('Procedure revision'));
                                        $table_header[] = array('header' => 
lang('Procedure title'));
@@ -550,7 +562,8 @@
                                        $table_header[] = array('header' => 
lang('Procedure start date'));
                                        $table_header[] = array('header' => 
lang('Procedure end date'));
 
-                                       $revised_procedures = 
$this->so->get_old_revisions($procedure->get_id());
+                                       $revised_procedures = 
$this->so->get_other_revisions($procedure->get_id());
+                                       $table_values = array();
                                        foreach ($revised_procedures as $rev)
                                        {
                                                $rev['link'] = 
self::link(array('menuaction' => 'controller.uiprocedure.view',
@@ -590,14 +603,16 @@
 
                public function view_procedures_for_control()
                {
-                       $control_id = phpgw::get_var('control_id');
-                       $location_code = phpgw::get_var('location_code');
 
+                       $check_list_id = phpgw::get_var('check_list_id', 'int');
+                       $control_id = phpgw::get_var('control_id', 'int');
+                       $location_code = phpgw::get_var('location_code', 
'string');
+
                        $control = $this->so_control->get_single($control_id);
 
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
 
-                       $control_procedure = 
$this->so->get_single_with_documents($control->get_procedure_id(), 
"return_array");
+                       $control_procedure = 
$this->so->get_single_with_documents($control->get_procedure_id(),$check_list_id,
 "return_array");
 
                        $control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control_id);
 
@@ -605,7 +620,7 @@
 
                        foreach ($control_groups as $control_group)
                        {
-                               $group_procedure = 
$this->so->get_single($control_group->get_procedure_id());
+                               $group_procedure = 
$this->so->get_single_no_documents($control_group->get_procedure_id(), 
$check_list_id );
                                if (isset($group_procedure))
                                {
                                        $group_procedures_array[] = 
array("control_group" => $control_group->toArray(),

Modified: 
branches/Version-2_0-branch/controller/templates/base/check_list/print_check_list.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/check_list/print_check_list.xsl
       2017-08-09 09:35:54 UTC (rev 16959)
+++ 
branches/Version-2_0-branch/controller/templates/base/check_list/print_check_list.xsl
       2017-08-09 09:37:20 UTC (rev 16960)
@@ -2,27 +2,37 @@
 
 <xsl:template match="data">
     
-    <h1><xsl:value-of select="control/title" /></h1>
-    <xsl:choose>
-        <xsl:when test="location_level = 1">
-                <h2>Eiendom: <xsl:value-of 
select="location_array/loc1_name"/></h2>
-        </xsl:when>
-        <xsl:otherwise>
-                <h2>Bygg: <xsl:value-of 
select="location_array/loc2_name"/></h2>
-        </xsl:otherwise>
-    </xsl:choose>
+       <h1>
+               <xsl:value-of select="control/title" />
+       </h1>
+       <xsl:choose>
+               <xsl:when test="location_level = 1">
+                       <h2>Eiendom: <xsl:value-of 
select="location_array/loc1_name"/></h2>
+               </xsl:when>
+               <xsl:otherwise>
+                       <h2>Bygg: <xsl:value-of 
select="location_array/loc2_name"/></h2>
+               </xsl:otherwise>
+       </xsl:choose>
 
-<ul class="groups">
-       <xsl:for-each select="saved_groups_with_items_array">
-               <li class="drag_group list_item">
-                       <h3><span class="group_order_nr"><xsl:number/></span>. 
<xsl:value-of select="control_group/group_name"/></h3>
+       <ul class="groups">
+               <xsl:for-each select="saved_groups_with_items_array">
+                       <li class="drag_group list_item">
+                               <h3>
+                                       <span class="group_order_nr">
+                                               <xsl:number/>
+                                       </span>. <xsl:value-of 
select="control_group/group_name"/>
+                               </h3>
        
-                               <xsl:variable 
name="control_group_id"><xsl:value-of select="control_group/id"/></xsl:variable>
+                               <xsl:variable name="control_group_id">
+                                       <xsl:value-of 
select="control_group/id"/>
+                               </xsl:variable>
                                <input type="hidden" name="control_group_id" 
value="{$control_group_id}" />
                
-                               <ul id="list">
+                               <ul id="list">
                                        <xsl:for-each select="control_items">
-                                               <xsl:variable 
name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
+                                               <xsl:variable 
name="control_item_id">
+                                                       <xsl:value-of 
select="id"/>
+                                               </xsl:variable>
                                                <xsl:variable name="order_tag">
                                                        <xsl:choose>
                                                                <xsl:when 
test="order_nr > 0">
@@ -34,55 +44,98 @@
                                                        
</xsl:choose>:<xsl:value-of select="id"/>
                                                </xsl:variable>
                                                                                
                                
-                                               <li class="list_item">
-                                                       <span 
class="order_nr"><xsl:number/></span>. <xsl:value-of select="title"/><input 
type="hidden" name="order_nr[]" value="{$order_tag}" />
-                                                       <br/><i>Hva skal 
utføres</i><br/><xsl:value-of select="what_to_do" 
disable-output-escaping="yes"/>
-                                                       
<br/><br/><i>Utførelsesbeskrivelse</i><br/><xsl:value-of select="how_to_do" 
disable-output-escaping="yes"/><br/>
-                                               </li>
+                                               <li class="list_item">
+                                                       <span class="order_nr">
+                                                               <xsl:number/>
+                                                       </span>. <xsl:value-of 
select="title"/>
+                                                       <input type="hidden" 
name="order_nr[]" value="{$order_tag}" />
+                                                       <br/>
+                                                       <i>Hva skal utføres</i>
+                                                       <br/>
+                                                       <xsl:value-of 
select="what_to_do" disable-output-escaping="yes"/>
+                                                       <br/>
+                                                       <br/>
+                                                       
<i>Utførelsesbeskrivelse</i>
+                                                       <br/>
+                                                       <xsl:value-of 
select="how_to_do" disable-output-escaping="yes"/>
+                                                       <br/>
+                                               </li>
                                        </xsl:for-each>
                                </ul>
-               </li>
-       </xsl:for-each>
-</ul>
+                       </li>
+               </xsl:for-each>
+       </ul>
 
-<style>
-.btn{
-       background: none repeat scroll 0 0 #2647A0;
-    color: #FFFFFF;
-    display: inline-block;
-    margin-right: 5px;
-    padding: 5px 10px;
-    text-decoration: none;
-    border: 1px solid #173073;
-    cursor: pointer;
-}
+       <style>
+               html {
+               font-family: arial;
+               }
+               @page {
+               size: A4;
+               }
 
-ul{
-       list-style: none outside none;
-}
+               @media print {
+                       li {page-break-inside: avoid;}
+                       h1, h2, h3, h4, h5 {
+                       page-break-after: avoid;
+                       }
 
-li{
-       list-style: none outside none;
-}
+                       table, figure {
+                       page-break-inside: avoid;
+                       }
+               }
 
-li.list_item ol li{
-    list-style: decimal;
-}
+
+               @page:left{
+               @bottom-left {
+               content: "Page " counter(page) " of " counter(pages);
+               }
+               }
+               @media print
+               {
+                       .btn
+                       {
+                               display: none !important;
+                       }
+               }
+
+               .btn{
+               background: none repeat scroll 0 0 #2647A0;
+               color: #FFFFFF;
+               display: inline-block;
+               margin-right: 5px;
+               padding: 5px 10px;
+               text-decoration: none;
+               border: 1px solid #173073;
+               cursor: pointer;
+               }
+
+               ul{
+               list-style: none outside none;
+               }
+
+               li{
+               list-style: none outside none;
+               }
+
+               li.list_item ol li{
+               list-style: decimal;
+               }
     
-ul.groups li {
-    padding: 3px 0;
-}
+               ul.groups li {
+               padding: 3px 0;
+               }
 
-ul.groups li.odd{
-    background: none repeat scroll 0 0 #DBE7F5;
-}
+               ul.groups li.odd{
+               background: none repeat scroll 0 0 #DBE7F5;
+               }
 
-ul.groups h3 {
-    font-size: 18px;
-    margin: 0 0 5px;
-}
+               ul.groups h3 {
+               font-size: 18px;
+               margin: 0 0 5px;
+               }
 
-</style>
-<a id="exec-print" href="#print" class="btn" onClick="window.print()">Skriv 
ut</a>
+       </style>
+       <a id="exec-print" href="#print" class="btn" 
onClick="window.print()">Skriv ut</a>
 
 </xsl:template>

Modified: 
branches/Version-2_0-branch/controller/templates/base/check_list/view_control_info.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/check_list/view_control_info.xsl
      2017-08-09 09:35:54 UTC (rev 16959)
+++ 
branches/Version-2_0-branch/controller/templates/base/check_list/view_control_info.xsl
      2017-08-09 09:37:20 UTC (rev 16960)
@@ -101,6 +101,8 @@
                <a id="view_procedures">
                        <xsl:attribute name="value">
                                
<xsl:text>index.php?menuaction=controller.uiprocedure.view_procedures_for_control</xsl:text>
+                               <xsl:text>&amp;check_list_id=</xsl:text>
+                               <xsl:value-of select="check_list/id"/>
                                <xsl:text>&amp;control_id=</xsl:text>
                                <xsl:value-of select="control/id"/>
                                <xsl:text>&amp;location_code=</xsl:text>

Modified: 
branches/Version-2_0-branch/controller/templates/base/procedure/print_procedure.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/procedure/print_procedure.xsl
 2017-08-09 09:35:54 UTC (rev 16959)
+++ 
branches/Version-2_0-branch/controller/templates/base/procedure/print_procedure.xsl
 2017-08-09 09:37:20 UTC (rev 16960)
@@ -2,119 +2,157 @@
 <!-- item  -->
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')" 
/></xsl:variable>
 
-<div id="procedure">
-               <h1><xsl:value-of select="procedure/title" /></h1>
+       <xsl:variable name="date_format">
+               <xsl:value-of select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')" />
+       </xsl:variable>
+       <html>
+               <body>
+                       <div id="procedure" style="width: 600px;">
+                               <h1>
+                                       <xsl:value-of select="procedure/title" 
/>
+                               </h1>
+                               <h4>
+                                       <xsl:value-of 
select="php:function('lang','Procedure revision')" />
+                               </h4>
+                               <xsl:value-of select="procedure/revision_no" />
+                               <h4>
+                                       <xsl:value-of 
select="php:function('lang','Control area')" />
+                               </h4>
+                               <xsl:value-of 
select="procedure/control_area_name" />
+                               <h4>
+                                       <xsl:value-of 
select="php:function('lang','Procedure valid from date')" />
+                               </h4>
+                               <xsl:if test="procedure/start_date != 0">
+                                       <xsl:variable name="startdate">
+                                               <xsl:value-of 
select="procedure/start_date" />
+                                       </xsl:variable>
+                                       <xsl:value-of 
select="php:function('date', $date_format, $startdate)" />
+                               </xsl:if>
+                               <xsl:if test="procedure/revision_date != 0">
+                                       <h4>
+                                               <xsl:value-of 
select="php:function('lang','Procedure revision date')" />
+                                       </h4>
+                                       <xsl:variable name="revisiondate">
+                                               <xsl:value-of 
select="procedure/revision_date" />
+                                       </xsl:variable>
+                                       <xsl:value-of 
select="php:function('date', $date_format, $revisiondate)" />
+                               </xsl:if>
+                               <xsl:if test="procedure/end_date != 0">
+                                       <h4>
+                                               <xsl:value-of 
select="php:function('lang','Procedure end date')" />
+                                       </h4>
+                                       <xsl:value-of 
select="procedure/end_date" />
+                                       <xsl:variable name="enddate">
+                                               <xsl:value-of 
select="procedure/end_date" />
+                                       </xsl:variable>
+                                       <xsl:value-of 
select="php:function('date', $date_format, $enddate)" />
+                               </xsl:if>
+                               <h4>
+                                       <xsl:value-of 
select="php:function('lang','Procedure purpose')" />
+                               </h4>
+                               <xsl:value-of select="procedure/purpose" 
disable-output-escaping="yes"/>
+                               <h4>
+                                       <xsl:value-of 
select="php:function('lang','Procedure responsibility')" />
+                               </h4>
+                               <xsl:value-of select="procedure/responsibility" 
disable-output-escaping="yes"/>
+                               <h4>
+                                       <xsl:value-of 
select="php:function('lang','Procedure description')" />
+                               </h4>
+                               <xsl:value-of select="procedure/description" 
disable-output-escaping="yes"/>
+                               <h4>
+                                       <xsl:value-of 
select="php:function('lang','Procedure Reference')" />
+                               </h4>
+                               <xsl:value-of select="procedure/reference" 
disable-output-escaping="yes"/>
+                       </div>
+                       <br/>
+                       <a href="#print" class="btn" 
onClick="window.print()">Skriv ut</a>
+                       <style>
+                               @page {
+                               size: A4;
+                               }
 
-               <div>
-                       <label for="revision_no"><xsl:value-of 
select="php:function('lang','Procedure revision')" /></label>
-                       <span style="display: inline-block;width: 
600px;"><xsl:value-of select="procedure/revision_no" /></span>
-               </div>
-               <div>
-                       <label for="control_area"><xsl:value-of 
select="php:function('lang','Control area')" /></label>
-                       <span style="display: inline-block;width: 
600px;"><xsl:value-of select="procedure/control_area_name" /></span>
-               </div>
-               <div>
-                       <label for="start_date"><xsl:value-of 
select="php:function('lang','Procedure valid from date')" /></label>
-                        <xsl:if test="procedure/start_date != 0">
-                            <xsl:variable name="startdate"><xsl:value-of 
select="procedure/start_date" /></xsl:variable>
-                            <xsl:value-of select="php:function('date', 
$date_format, $startdate)" />
-                        </xsl:if>
-               </div>
-               <div>
-                        <xsl:if test="procedure/revision_date != 0">
-                            <label for="revision_date"><xsl:value-of 
select="php:function('lang','Procedure revision date')" /></label>
-                               <xsl:variable name="revisiondate"><xsl:value-of 
select="procedure/revision_date" /></xsl:variable>
-                               <xsl:value-of select="php:function('date', 
$date_format, $revisiondate)" />
-                       </xsl:if>
-               </div>
-               <div>
-                       <xsl:if test="procedure/end_date != 0">
-                               <label for="end_date"><xsl:value-of 
select="php:function('lang','Procedure end date')" /></label>
-                       <xsl:value-of select="procedure/end_date" />
-                               <xsl:variable name="enddate"><xsl:value-of 
select="procedure/end_date" /></xsl:variable>
-                               <xsl:value-of select="php:function('date', 
$date_format, $enddate)" />
-                       </xsl:if>
-               </div>
-               <div>
-                       <label for="purpose"><xsl:value-of 
select="php:function('lang','Procedure purpose')" /></label>
-                       <span style="display: inline-block;width: 
600px;"><xsl:value-of select="procedure/purpose" 
disable-output-escaping="yes"/></span>
-               </div>
-               <div>
-                       <label for="responsibility"><xsl:value-of 
select="php:function('lang','Procedure responsibility')" /></label>
-                       <span style="display: inline-block;width: 
600px;"><xsl:value-of select="procedure/responsibility" 
disable-output-escaping="yes"/></span>
-               </div>
-               <div>
-                       <label for="description"><xsl:value-of 
select="php:function('lang','Procedure description')" /></label>
-                       <span style="display: inline-block;width: 
600px;"><xsl:value-of select="procedure/description" 
disable-output-escaping="yes"/></span>
-               </div>
-               <div>
-                       <label for="reference"><xsl:value-of 
select="php:function('lang','Procedure Reference')" /></label>
-      <span style="display: inline-block;width: 600px;">
-        <xsl:value-of select="procedure/reference" 
disable-output-escaping="yes"/>
-      </span>
-               </div>
-               <a href="#print" class="btn" onClick="window.print()">Skriv 
ut</a>              
-</div>
-<style>
+                               @media print {
+                                       li {page-break-inside: avoid;}
+                                       h1, h2, h3, h4, h5 {
+                                       page-break-after: avoid;
+                                       }
 
-       #procedure {
-          font-family: arial;
-          font-size: 15px;
-       padding: 5px 25px;
-       }
-       #procedure h1{
-       font-size: 24px;
-       margin-bottom: 25px;
-       }       
-       #procedure div {
-       margin: 15px 0;
-       }
-       label{ 
-               display: inline-block;
-       font-weight: bold;
-       vertical-align: top;
-       width: 200px;
-       }
+                                       table, figure {
+                                       page-break-inside: avoid;
+                                       }
+                               }
 
-       .btn {
-    background: none repeat scroll 0 0 #4F9AEA;
-    border: 1px solid #428AD7;
-    border-radius: 4px 4px 4px 4px;
-    color: #FFFFFF;
-    cursor: pointer;
-    display: inline-block;
-    margin-right: 10px;
-    padding: 5px 10px;
-    text-decoration: none;
-}
+
+                               @page:left{
+                               @bottom-left {
+                               content: "Page " counter(page) " of " 
counter(pages);
+                               }
+                               }
+                               @media print
+                               {
+                                       .btn
+                                       {
+                                               display: none !important;
+                                       }
+                               }
+                               #procedure {
+                               font-family: arial;
+                               font-size: 15px;
+                               padding: 5px 25px;
+                               }
+                               #procedure h1{
+                               font-size: 24px;
+                               margin-bottom: 25px;
+                               }
+                               #procedure div {
+                               margin: 15px 0;
+                               }
+                               label{
+                               
+                               font-weight: bold;
+                               vertical-align: top;
+                               width: 200px;
+                               }
+
+                               .btn {
+                               background: none repeat scroll 0 0 #4F9AEA;
+                               border: 1px solid #428AD7;
+                               border-radius: 4px 4px 4px 4px;
+                               color: #FFFFFF;
+                               cursor: pointer;
+                               margin-right: 10px;
+                               padding: 5px 10px;
+                               text-decoration: none;
+                               }
        
-       ol{
-               margin: 15px;
-       padding: 0 20px;
-       }
+                               ol{
+                               margin: 15px;
+                               padding: 0 20px;
+                               }
        
-       ul{
-               list-style: none outside none;
-       }
+                               ul{
+                               list-style: none outside none;
+                               }
        
-       ul.groups li {
-           padding: 3px 0;
-       }
+                               ul.groups li {
+                               padding: 3px 0;
+                               }
        
-       ul.groups li.odd{
-           background: none repeat scroll 0 0 #DBE7F5;
-       }
+                               ul.groups li.odd{
+                               background: none repeat scroll 0 0 #DBE7F5;
+                               }
        
-       ul.groups h3 {
-           font-size: 18px;
-           margin: 0 0 5px;
-       }
+                               ul.groups h3 {
+                               font-size: 18px;
+                               margin: 0 0 5px;
+                               }
     
-        #procedure ul li{
-            list-style: disc;
-        }
+                               #procedure ul li{
+                               list-style: disc;
+                               }
                
-</style>
+                       </style>
+               </body>
+       </html>
 </xsl:template>
\ No newline at end of file

Modified: 
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
===================================================================
--- 
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
  2017-08-09 09:35:54 UTC (rev 16959)
+++ 
branches/Version-2_0-branch/controller/templates/base/procedure/procedure_item.xsl
  2017-08-09 09:37:20 UTC (rev 16960)
@@ -3,9 +3,11 @@
 
 <xsl:template name="view_procedure" xmlns:php="http://php.net/xsl";>
 
-<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')" 
/></xsl:variable>
+       <xsl:variable name="date_format">
+               <xsl:value-of select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')" />
+       </xsl:variable>
 
-<div class="yui-content">
+       <div class="yui-content">
                <div id="details">
                        <form action="#" method="post">
                                <input type="hidden" name="id" value = 
"{value_id}">
@@ -12,132 +14,160 @@
                                </input>
                                <dl class="proplist-col">
                                        <dt>
-                                               <label 
for="title"><xsl:value-of select="php:function('lang','Procedure title')" 
/></label>
+                                               <label for="title">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure title')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <input type="text" 
name="title" id="title" value="{procedure/title}" size="100"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/title" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <input 
type="text" name="title" id="title" value="{procedure/title}" size="100"/>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/title" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="revision_no"><xsl:value-of select="php:function('lang','Procedure 
revision')" /></label>
+                                               <label for="revision_no">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure revision')" />
+                                               </label>
                                        </dt>
                                        <dd>
                                                <xsl:value-of 
select="procedure/revision_no" />
                                        </dd>
                                        <dt>
-                                               <label 
for="control_area"><xsl:value-of select="php:function('lang','Control area')" 
/></label>
+                                               <label for="control_area">
+                                                       <xsl:value-of 
select="php:function('lang','Control area')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <select 
id="control_area" name="control_area">
-                                                               
<xsl:apply-templates select="control_area/options"/>
-                                                       </select>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/control_area_name" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <select 
id="control_area" name="control_area">
+                                                                       
<xsl:apply-templates select="control_area/options"/>
+                                                               </select>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/control_area_name" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="start_date"><xsl:value-of select="php:function('lang','Procedure start 
date')" /></label>
+                                               <label for="start_date">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure start date')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <input type="text" 
id="start_date" name="start_date" size="10" value="{start_date}" 
readonly="readonly">
-                                                       </input>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/start_date" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <input 
type="text" id="start_date" name="start_date" size="10" value="{start_date}" 
readonly="readonly">
+                                                               </input>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/start_date" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="revision_date"><xsl:value-of select="php:function('lang','Procedure 
revision date')" /></label>
+                                               <label for="revision_date">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure revision date')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <input type="text" 
id="revision_date" name="revision_date" size="10" value="{revision_date}" 
readonly="readonly">
-                                                       </input>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/revision_date" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <input 
type="text" id="revision_date" name="revision_date" size="10" 
value="{revision_date}" readonly="readonly">
+                                                               </input>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/revision_date" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="end_date"><xsl:value-of select="php:function('lang','Procedure end date')" 
/></label>
+                                               <label for="end_date">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure end date')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <input type="text" 
id="end_date" name="end_date" size="10" value="{end_date}" readonly="readonly">
-                                                       </input>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/end_date" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <input 
type="text" id="end_date" name="end_date" size="10" value="{end_date}" 
readonly="readonly">
+                                                               </input>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/end_date" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="purpose"><xsl:value-of select="php:function('lang','Procedure purpose')" 
/></label>
+                                               <label for="purpose">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure purpose')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <textarea id="purpose" 
name="purpose" rows="5" cols="60" style="width: 690px;"><xsl:value-of 
select="procedure/purpose" disable-output-escaping="yes"/></textarea>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/purpose" disable-output-escaping="yes"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <textarea 
id="purpose" name="purpose" rows="5" cols="60" style="width: 690px;">
+                                                                       
<xsl:value-of select="procedure/purpose" disable-output-escaping="yes"/>
+                                                               </textarea>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/purpose" disable-output-escaping="yes"/>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="responsibility"><xsl:value-of select="php:function('lang','Procedure 
responsibility')" /></label>
+                                               <label for="responsibility">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure responsibility')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <textarea 
id="responsibility" name="responsibility" rows="5" cols="60"><xsl:value-of 
select="procedure/responsibility" /></textarea>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/responsibility" disable-output-escaping="yes"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <textarea 
id="responsibility" name="responsibility" rows="5" cols="60">
+                                                                       
<xsl:value-of select="procedure/responsibility" />
+                                                               </textarea>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/responsibility" disable-output-escaping="yes"/>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="description"><xsl:value-of select="php:function('lang','Procedure 
description')" /></label>
+                                               <label for="description">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure description')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <textarea 
id="description" name="description" rows="5" cols="60"><xsl:value-of 
select="procedure/description" disable-output-escaping="yes"/></textarea>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/description" disable-output-escaping="yes"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <textarea 
id="description" name="description" rows="5" cols="60">
+                                                                       
<xsl:value-of select="procedure/description" disable-output-escaping="yes"/>
+                                                               </textarea>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/description" disable-output-escaping="yes"/>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>
                                        <dt>
-                                               <label 
for="reference"><xsl:value-of select="php:function('lang','Procedure 
Reference')" /></label>
+                                               <label for="reference">
+                                                       <xsl:value-of 
select="php:function('lang','Procedure Reference')" />
+                                               </label>
                                        </dt>
                                        <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <textarea 
id="reference" name="reference" rows="5" cols="60"><xsl:value-of 
select="procedure/reference" disable-output-escaping="yes"/></textarea>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="procedure/reference" disable-output-escaping="yes"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable">
+                                                               <textarea 
id="reference" name="reference" rows="5" cols="60">
+                                                                       
<xsl:value-of select="procedure/reference" disable-output-escaping="yes"/>
+                                                               </textarea>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="procedure/reference" disable-output-escaping="yes"/>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </dd>                           
                                </dl>
                                
@@ -144,19 +174,29 @@
                                <div class="form-buttons">
                                        <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>
+                                                       <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:when test="inactive">
-                                                       <xsl:variable 
name="lang_back"><xsl:value-of select="php:function('lang', 'back')" 
/></xsl:variable>
+                                                       <xsl:variable 
name="lang_back">
+                                                               <xsl:value-of 
select="php:function('lang', 'back')" />
+                                                       </xsl:variable>
                                                        <input type="button" 
value="{$lang_back}" title="{$lang_back}" onclick="javascript: history.go(-1);" 
class="btn"/>
                                                </xsl:when>
                                                <xsl:otherwise>
-                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
+                                                       <xsl:variable 
name="lang_edit">
+                                                               <xsl:value-of 
select="php:function('lang', 'edit')" />
+                                                       </xsl:variable>
                                                        <input type="submit" 
name="edit_procedure" value="{$lang_edit}" title = "{$lang_edit}" />
                                                </xsl:otherwise>
                                        </xsl:choose>
@@ -164,9 +204,14 @@
                        </form>
                        <xsl:choose>
                                <xsl:when test="values != ''">
-                                       <table>
-                                               <xsl:call-template 
name="table_header_history"/>
-                                               <xsl:call-template 
name="values_history"/>
+                                       <table class="pure-table">
+                                               <thead>
+
+                                                       <xsl:call-template 
name="table_header_history"/>
+                                               </thead>
+                                               <tbody>
+                                                       <xsl:call-template 
name="values_history"/>
+                                               </tbody>
                                        </table>
                                </xsl:when>
                        </xsl:choose>
@@ -175,42 +220,47 @@
 </xsl:template>
 
 <xsl:template name="table_header_history">
-               <th class="th">
-                       <xsl:for-each select="table_header" >
+       <tr>
+               <xsl:for-each select="table_header" >
+                       <th>
+                               <xsl:value-of select="header"/>
+                       </th>
+               </xsl:for-each>
+       </tr>
+</xsl:template>
+
+<xsl:template name="values_history">
+
+       <xsl:for-each select="values" >
+               <tr>
+                       <xsl:for-each select="row" >
+                               <xsl:variable name="proc_link">
+                                       <xsl:value-of select='link'/>
+                               </xsl:variable>
                                <td>
-                                       <xsl:value-of select="header"/>
+                                       <a href="{$proc_link}">
+                                               <xsl:value-of 
select="revision_no"/>
+                                       </a>
                                </td>
+                               <td>
+                                       <xsl:value-of select="title"/>
+                               </td>
+                               <td>
+                                       <xsl:value-of select="start_date"/>
+                               </td>
+                               <td>
+                                       <xsl:value-of select="end_date"/>
+                               </td>
                        </xsl:for-each>
-               </th>
-       </xsl:template>
-
-       <xsl:template name="values_history">
-               <xsl:for-each select="values" >
-                       <tr>
-                               <xsl:for-each select="row" >
-                                       <xsl:variable 
name="proc_link"><xsl:value-of select='link'/></xsl:variable>
-                                       <td>
-                                               <a 
href="{$proc_link}"><xsl:value-of select="revision_no"/></a>
-                                       </td>
-                                       <td>
-                                               <xsl:value-of select="title"/>
-                                       </td>
-                                       <td>
-                                               <xsl:value-of 
select="start_date"/>
-                                       </td>
-                                       <td>
-                                               <xsl:value-of 
select="end_date"/>
-                                       </td>
-                               </xsl:for-each>
-                       </tr>
-               </xsl:for-each>
-       </xsl:template>
+               </tr>
+       </xsl:for-each>
+</xsl:template>
        
-       <xsl:template match="options">
-               <option value="{id}">
-                       <xsl:if test="selected">
-                               <xsl:attribute name="selected" value="selected" 
/>
-                       </xsl:if>
-                       <xsl:value-of disable-output-escaping="yes" 
select="name"/>
-               </option>
-       </xsl:template>
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected">
+                       <xsl:attribute name="selected" value="selected" />
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php     
2017-08-09 09:35:54 UTC (rev 16959)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php     
2017-08-09 09:37:20 UTC (rev 16960)
@@ -599,15 +599,16 @@
                                }
                        }
 
+                       $request_scheme = empty($_SERVER['HTTPS']) || 
$_SERVER['HTTPS'] == 'off' ? 'http' : 'https';
+
                        if($external || 
$GLOBALS['phpgw_info']['server']['webserver_url'] == '/')
                        {
                                if(substr($url, 0, 4) != 'http')
                                {
-                                       $url = 
"http://{$GLOBALS['phpgw_info']['server']['hostname']}{$url}";
+                                       $url = 
"{$request_scheme}://{$GLOBALS['phpgw_info']['server']['hostname']}{$url}";
                                }
                        }
 
-                       $request_scheme = empty($_SERVER['HTTPS']) || 
$_SERVER['HTTPS'] == 'off' ? 'http' : 'https';
 
                        if($request_scheme == 'https')
                        {

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.xslttemplates.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.xslttemplates.inc.php        
2017-08-09 09:35:54 UTC (rev 16959)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.xslttemplates.inc.php        
2017-08-09 09:37:20 UTC (rev 16960)
@@ -443,6 +443,11 @@
 
                        $html = preg_replace('/<!DOCTYPE([^>])+>/', '', $html);
 
+                       if($stripped_htm)
+                       {
+                               $html = "<!DOCTYPE html>" . $html;
+                       }
+
                        return $html;
                }
 




reply via email to

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