phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property inc/class.boadmin_location.inc.php inc...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property inc/class.boadmin_location.inc.php inc...
Date: Tue, 03 Oct 2006 09:58:09 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   06/10/03 09:58:09

Modified files:
        inc            : class.boadmin_location.inc.php 
                         class.soadmin_location.inc.php 
                         class.socommon.inc.php class.soentity.inc.php 
                         class.solocation.inc.php 
                         class.uiadmin_location.inc.php 
                         class.uilocation.inc.php 
        setup          : default_records.inc.php tables_current.inc.php 
        templates/base : admin_location.xsl 

Log message:
        E_NOTICES and fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.boadmin_location.inc.php?cvsroot=phpgroupware&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.soadmin_location.inc.php?cvsroot=phpgroupware&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.socommon.inc.php?cvsroot=phpgroupware&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.soentity.inc.php?cvsroot=phpgroupware&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.solocation.inc.php?cvsroot=phpgroupware&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.uiadmin_location.inc.php?cvsroot=phpgroupware&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.uilocation.inc.php?cvsroot=phpgroupware&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/property/setup/default_records.inc.php?cvsroot=phpgroupware&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/property/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/property/templates/base/admin_location.xsl?cvsroot=phpgroupware&r1=1.1&r2=1.2

Patches:
Index: inc/class.boadmin_location.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.boadmin_location.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- inc/class.boadmin_location.inc.php  6 Sep 2006 07:18:36 -0000       1.11
+++ inc/class.boadmin_location.inc.php  3 Oct 2006 09:58:09 -0000       1.12
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.boadmin_location.inc.php,v 1.11 2006/09/06 
07:18:36 sigurdne Exp $
+       * @version $Id: class.boadmin_location.inc.php,v 1.12 2006/10/03 
09:58:09 sigurdne Exp $
        */
 
        /**
@@ -151,22 +151,18 @@
                        return $this->so->read_single($id);
                }
 
-               function save($standard,$action='')
+               function save($standard)
                {
-                       if ($action=='edit')
-                       {
-                               if ($standard['id'] != '')
+                       if (isset($standard['id']) && $standard['id'])
                                {
-
                                        $receipt = $this->so->edit($standard);
-                               }
+
                        }
                        else
                        {
                                $receipt = $this->so->add($standard);
                        }
                        return $receipt;
-
                }
 
                function delete($type_id,$id,$attrib)

Index: inc/class.soadmin_location.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.soadmin_location.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- inc/class.soadmin_location.inc.php  18 Sep 2006 08:22:32 -0000      1.25
+++ inc/class.soadmin_location.inc.php  3 Oct 2006 09:58:09 -0000       1.26
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.soadmin_location.inc.php,v 1.25 2006/09/18 
08:22:32 sigurdne Exp $
+       * @version $Id: class.soadmin_location.inc.php,v 1.26 2006/10/03 
09:58:09 sigurdne Exp $
        */
 
        /**
@@ -96,7 +96,6 @@
                                (
                                        'id'    => $this->db->f('id'),
                                        'name'  => $this->db->f('name'),
-                                       'prefix'=> $this->db->f('prefix'),
                                        'descr' => $this->db->f('descr')
                                );
                        }
@@ -188,7 +187,6 @@
                                $standard['id']                 = 
$this->db->f('id');
                                $standard['name']               = 
$this->db->f('name');
                                $standard['descr']              = 
$this->db->f('descr');
-                               $standard['prefix']             = 
$this->db->f('prefix');
 
                                return $standard;
                        }
@@ -202,14 +200,12 @@
 
                        $standard['id'] = 
$this->bocommon->next_id('fm_location_type');
 
-                       $this->db->transaction_begin();
-
-
                        $receipt['id']= $standard['id'];
 
                        $this->init_process();
 
-                       $default_attrib['id'][]= 1;
+                       $j=1;
+                       $default_attrib['id'][]= $j;
                        $default_attrib['column_name'][]= 'location_code';
                        $default_attrib['type'][]='V';
                        $default_attrib['precision'][] =4*$standard['id'];
@@ -219,7 +215,8 @@
                        $default_attrib['attrib_sort'][] ='NULL';
                        $default_attrib['custom'][] ='NULL';
 
-                       $default_attrib['id'][]= 2;
+                       $j++;
+                       $default_attrib['id'][]= $j;
                        $default_attrib['column_name'][]= 'loc' . 
$standard['id'] . '_name';
                        $default_attrib['type'][]='V';
                        $default_attrib['precision'][] =50;
@@ -229,7 +226,8 @@
                        $default_attrib['attrib_sort'][] ='NULL';
                        $default_attrib['custom'][] ='NULL';
 
-                       $default_attrib['id'][]= 3;
+                       $j++;
+                       $default_attrib['id'][]= $j;
                        $default_attrib['column_name'][]= 'entry_date';
                        $default_attrib['type'][]='I';
                        $default_attrib['precision'][] =4;
@@ -239,7 +237,8 @@
                        $default_attrib['attrib_sort'][] ='NULL';
                        $default_attrib['custom'][] ='NULL';
 
-                       $default_attrib['id'][]= 4;
+                       $j++;
+                       $default_attrib['id'][]= $j;
                        $default_attrib['column_name'][]= 'category';
                        $default_attrib['type'][]='I';
                        $default_attrib['precision'][] =4;
@@ -249,7 +248,8 @@
                        $default_attrib['attrib_sort'][] ='NULL';
                        $default_attrib['custom'][] ='NULL';
 
-                       $default_attrib['id'][]= 5;
+                       $j++;
+                       $default_attrib['id'][]= $j;
                        $default_attrib['column_name'][]= 'user_id';
                        $default_attrib['type'][]='I';
                        $default_attrib['precision'][] =4;
@@ -259,7 +259,9 @@
                        $default_attrib['attrib_sort'][] ='NULL';
                        $default_attrib['custom'][] ='NULL';
 
-                       $default_attrib['id'][]= 6;
+                       $j++;
+                       $status_id = $j;
+                       $default_attrib['id'][]= $j;
                        $default_attrib['column_name'][]= 'status';
                        $default_attrib['type'][]='LB';
                        $default_attrib['precision'][] = False;
@@ -269,7 +271,8 @@
                        $default_attrib['attrib_sort'][] =1;
                        $default_attrib['custom'][] =1;
 
-                       $default_attrib['id'][]= 7;
+                       $j++;
+                       $default_attrib['id'][]= $j;
                        $default_attrib['column_name'][]= 'remark';
                        $default_attrib['type'][]='T';
                        $default_attrib['precision'][] = False;
@@ -279,6 +282,17 @@
                        $default_attrib['attrib_sort'][] =2;
                        $default_attrib['custom'][] =1;
 
+                       $j++;
+                       $default_attrib['id'][]= $j;
+                       $default_attrib['column_name'][]= 'change_type';
+                       $default_attrib['type'][]='I';
+                       $default_attrib['precision'][] =4;
+                       $default_attrib['nullable'][] ='True';
+                       $default_attrib['input_text'][] ='dummy';
+                       $default_attrib['statustext'][] ='dummy';
+                       $default_attrib['attrib_sort'][] ='NULL';
+                       $default_attrib['custom'][] ='NULL';
+
                        $fd=array();
                        $fd['location_code'] = array('type' => 'varchar', 
'precision' => 25, 'nullable' => False);
 
@@ -287,7 +301,7 @@
                                $fd['loc' . $i] = array('type' => 'varchar', 
'precision' => 4, 'nullable' => False);
                                $pk[$i-1]= 'loc' . $i;
 
-                               $default_attrib['id'][]= $i+7;
+                               $default_attrib['id'][]= $i+$j;
                                $default_attrib['column_name'][]= 'loc' . $i;
                                $default_attrib['type'][]='V';
                                $default_attrib['precision'][] =4;
@@ -316,6 +330,7 @@
                        $fd['user_id'] = array('type' => 'int', 'precision' => 
4, 'nullable' => True);
                        $fd['remark'] = array('type' => 'text', 'nullable' => 
True);
                        $fd['status'] = array('type' => 'int', 'precision' => 
4, 'nullable' => True);
+                       $fd['change_type'] = array('type' => 'int', 'precision' 
=> 4, 'nullable' => True);
 
                        $ix = array('location_code');
                        $uc = array();
@@ -326,6 +341,8 @@
 
                        
$add_columns_in_tables=array('fm_project','fm_tts_tickets','fm_request','fm_document','fm_investment');
 
+//                     $this->oProc->m_odb->transaction_begin();
+//                     $this->db->transaction_begin();
                        if($this->oProc->CreateTable('fm_location'. 
$standard['id'],array('fd' => $fd,'pk' => $pk,'fk' => $fk,'ix' => $ix,'uc' => 
$uc))
                                && $this->oProc->CreateTable('fm_location'. 
$standard['id'] . '_history',array('fd' => $fd_history)))
                        {
@@ -374,7 +391,6 @@
                                                $default_attrib['nullable'][$i]
                                                );
 
-
                                        $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);
 
                                        $this->db->query("INSERT INTO 
fm_location_attrib 
(type_id,id,column_name,datatype,precision_,input_text,statustext,attrib_sort,custom,nullable)
 "
@@ -384,17 +400,21 @@
                                $type_id=$standard['id'];
 
                                $this->db->query("INSERT INTO 
fm_location_choice (type_id,attrib_id,id,value) "
-                                       . "VALUES 
($type_id,1,1,'ok')",__LINE__,__FILE__);
+                                       . "VALUES 
($type_id,$status_id,1,'ok')",__LINE__,__FILE__);
                                $this->db->query("INSERT INTO 
fm_location_choice (type_id,attrib_id,id,value) "
-                                       . "VALUES ($type_id,1,2,'Not 
Active')",__LINE__,__FILE__);
-
-
-                               $receipt['message'][] = array('msg'     => 
lang('table %1 has been saved','fm_location'. $receipt['id'])        );
-                               $this->db->transaction_commit();
+                                       . "VALUES ($type_id,$status_id,2,'Not 
Ok')",__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO 
fm_location{$type_id}_category (id,descr) "
+                                       . "VALUES (1,'Category 
1')",__LINE__,__FILE__);
+                               $this->db->query("INSERT INTO 
fm_location{$type_id}_category (id,descr) "
+                                       . "VALUES (99,'Not 
active')",__LINE__,__FILE__);
+
+                               $receipt['message'][] = array('msg' => 
lang('table %1 has been saved','fm_location'. $receipt['id']));
+//                             $this->db->transaction_commit();
+//                             $this->oProc->m_odb->transaction_commit();
                        }
                        else
                        {
-                               $receipt['error'][] = array('msg'       => 
lang('table could not be added')     );
+                               $receipt['error'][] = array('msg' => 
lang('table could not be added'));
                                if($this->db->Transaction)
                                {
                                        $this->db->transaction_abort();
@@ -412,14 +432,6 @@
 
                function edit($standard)
                {
-
-                       if (!$standard['name'])
-                       {
-                               $receipt['error'][] = array('msg'=>lang('Name 
not entered!'));
-                       }
-
-                       if (!$receipt['error'])
-                       {
                                $table = 'fm_location_type';
 
                                $standard['name'] = 
$this->db->db_addslashes($standard['name']);
@@ -428,27 +440,21 @@
                                $this->db->query("UPDATE $table set descr='" . 
$standard['descr'] . "', name='". $standard['name']
                                        . "' WHERE id='" . $standard['id']. 
"'",__LINE__,__FILE__);
 
-
+                       $receipt['id'] = $standard['id'];
                                $receipt['message'][] = array('msg'=> 
lang('Standard has been edited'));
-                       }
-                       else
-                       {
-                               $receipt['error'][] = array('msg'       => 
lang('Standard has NOT been edited'));
-                       }
 
                        return $receipt;
                }
 
                function delete($type_id,$id,$attrib)
                {
-                       $table_def = $this->get_table_def($type_id);
-
                        $this->init_process();
                        $this->oProc->m_odb->transaction_begin();
                        $this->db->transaction_begin();
 
                        if($attrib)
                        {
+                               $table_def = $this->get_table_def($type_id);
                                $table = 'fm_location_attrib';
 
                                $this->db->query("SELECT column_name,type_id 
FROM fm_location_attrib WHERE id='" . $id . "'",__LINE__,__FILE__);
@@ -460,11 +466,23 @@
                        }
                        else
                        {
+                               $table          = 'fm_location_type';
+                               $this->db->query("SELECT max(id) as id FROM 
$table",__LINE__,__FILE__);
+                               $this->db->next_record();
+                               if($this->db->f('id') > $id)
+                               {
+                                       $this->db->transaction_abort();
+                                       
$this->oProc->m_odb->transaction_abort();
+                                       $receipt['error'][] = array('msg' => 
lang('please delete from the bottom'));
+                                       
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,$receipt);
+                                       
+                                       return;
+                               }
+                               
                                $this->oProc->DropTable('fm_location' . $id);
                                $this->oProc->DropTable('fm_location' . $id . 
'_category');
                                $this->oProc->DropTable('fm_location' . $id . 
'_history');
 
-                               $table                  = 'fm_location_type';
                                $attrib_table   = 'fm_location_attrib';
                                $this->db->query("DELETE FROM $attrib_table 
WHERE type_id='" . $id . "'",__LINE__,__FILE__);
                                $this->db->query("DELETE FROM 
fm_location_choice WHERE type_id='" . $id . "'",__LINE__,__FILE__);
@@ -613,8 +631,12 @@
                                        'value' => $this->db->f('value')
                                );
                        }
+
+                       if(isset($choice))
+                       {
                        return $choice;
                }
+               }
 
                function add_attrib($attrib)
                {
@@ -672,13 +694,13 @@
                        
if($this->oProc->AddColumn('fm_location'.$attrib['type_id'],$attrib['column_name'],
 $attrib['column_info'])
                                && 
$this->oProc->AddColumn('fm_location'.$attrib['type_id'] 
.'_history',$attrib['column_name'], $attrib['column_info']))
                        {
-                               $receipt['message'][] = array('msg'     => 
lang('Attribute has been saved')     );
+                               $receipt['message'][] = array('msg' => 
lang('Attribute has been saved'));
                                $this->db->transaction_commit();
 
                        }
                        else
                        {
-                               $receipt['error'][] = array('msg'       => 
lang('column could not be added')    );
+                               $receipt['error'][] = array('msg' => 
lang('column could not be added'));
                                if($this->db->Transaction)
                                {
                                        $this->db->transaction_abort();
@@ -887,7 +909,6 @@
 
                function get_table_def($id='')
                {
-
                        $metadata = $this->db->metadata('fm_location'.$id);
 
                        if(isset($this->db->adodb))

Index: inc/class.socommon.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.socommon.inc.php,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- inc/class.socommon.inc.php  19 Sep 2006 21:09:48 -0000      1.25
+++ inc/class.socommon.inc.php  3 Oct 2006 09:58:09 -0000       1.26
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage core
-       * @version $Id: class.socommon.inc.php,v 1.25 2006/09/19 21:09:48 
sigurdne Exp $
+       * @version $Id: class.socommon.inc.php,v 1.26 2006/10/03 09:58:09 
sigurdne Exp $
        */
 
        /**
@@ -18,7 +18,6 @@
 
        class socommon
        {
-
                /**
                 * @var string $join the sql syntax to use for JOIN
                 */
@@ -272,6 +271,7 @@
 
                function next_id($table='',$key='')
                {
+                       $where = '';
                        if(is_array($key))
                        {
                                while (is_array($key) && list($column,$value) = 
each($key))

Index: inc/class.soentity.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.soentity.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- inc/class.soentity.inc.php  27 Sep 2006 10:51:08 -0000      1.18
+++ inc/class.soentity.inc.php  3 Oct 2006 09:58:09 -0000       1.19
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage entity
-       * @version $Id: class.soentity.inc.php,v 1.18 2006/09/27 10:51:08 
sigurdne Exp $
+       * @version $Id: class.soentity.inc.php,v 1.19 2006/10/03 09:58:09 
sigurdne Exp $
        */
 
        /**
@@ -556,6 +556,11 @@
                                {
                                        if($entry['value'])
                                        {
+                                               if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V')
+                                               {
+                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                               }
+
                                                $cols[] = $entry['name'];
                                                $vals[] = $entry['value'];
 
@@ -618,7 +623,6 @@
 
                function edit($values,$values_attribute,$entity_id,$cat_id)
                {
-
                        if($values['street_name'])
                        {
                                $address[]= $values['street_name'];
@@ -657,9 +661,15 @@
                                {
                                        if($entry['datatype']!='AB' && 
$entry['datatype']!='VENDOR')
                                        {
+                                               if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V')
+                                               {
+                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                               }
+
                                                $value_set[$entry['name']]      
= $entry['value'];
                                        }
 
+
                                        if($entry['history'] == 1)
                                        {                                       
        
                                                $this->db->query("select " . 
$entry['name'] . " from $table WHERE id=" . $values['id'],__LINE__,__FILE__);

Index: inc/class.solocation.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.solocation.inc.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- inc/class.solocation.inc.php        28 Sep 2006 14:27:51 -0000      1.36
+++ inc/class.solocation.inc.php        3 Oct 2006 09:58:09 -0000       1.37
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage location
-       * @version $Id: class.solocation.inc.php,v 1.36 2006/09/28 14:27:51 
sigurdne Exp $
+       * @version $Id: class.solocation.inc.php,v 1.37 2006/10/03 09:58:09 
sigurdne Exp $
        */
 
        /**
@@ -106,6 +106,7 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $status = '';
                        $i = 0;
                        while ($this->db->next_record())
                        {
@@ -615,7 +616,6 @@
 
                function 
generate_sql($type_id='',$cols='',$cols_return='',$uicols='',$read_single='')
                {
-
                        $joinmethod = " fm_location" . ($type_id);
 
                        $location_types = 
$this->soadmin_location->select_location_type();
@@ -633,7 +633,7 @@
                        }
 
 
-                       if($type!=1)
+                       if($type_id !=1)
                        {
 //                             $cols.= ',fm_location1.loc1_name as loc1_name';
 //                             $cols_return[]                          = 
'loc1_name';
@@ -643,13 +643,13 @@
                                $uicols['statustext'][]         = 
lang('Property Name');
                        }
 
+                       $paranthesis = '';
                        for ($j=($type_id-1); $j>0; $j--)
                        {
                                $joinmethod .= " $this->join fm_location". ($j);
 
                                $paranthesis .='(';
 
-
                                $on = 'ON';
                                for ($i=($j); $i>0; $i--)
                                {
@@ -771,7 +771,6 @@
                                        $uicols['name'][]                       
= $fm_location_cols[$i]['column_name'];
                                        $uicols['descr'][]                      
= $fm_location_cols[$i]['input_text'];
                                        $uicols['statustext'][]         = 
$fm_location_cols[$i]['statustext'];
-
                                }
                                else
                                {
@@ -794,7 +793,7 @@
                        $this->uicols           = $uicols;
                        $this->cols_return      = $cols_return;
 
-                       $from .= " FROM $paranthesis $entity_table ";
+                       $from = " FROM $paranthesis ";
 
                        $sql = "SELECT $cols $from $joinmethod";
 
@@ -802,11 +801,6 @@
                        $this->socommon->fm_cache('uicols_single_'. 
$type_id,$uicols);
                        $this->socommon->fm_cache('cols_return_single_'. 
$type_id,$cols_return);
 
-
-//                     $GLOBALS['phpgw']->session->appsession('sql_single_'. 
$type_id ,$this->currentapp,$sql);
-//                     
$GLOBALS['phpgw']->session->appsession('uicols_single_'. $type_id 
,$this->currentapp,$uicols);
-//                     
$GLOBALS['phpgw']->session->appsession('cols_return_single_'. $type_id 
,$this->currentapp,$cols_return);
-
                        return $sql;
                }
 
@@ -829,7 +823,6 @@
                                $cols_return[]                          = 'loc' 
. $i .'_name';
                        }
 
-
                        $cols.= 'fm_location' . $type_id . '.change_type,';
                        $cols_return[]                          = 'change_type';
                        $uicols['input_type'][]         = 'text';
@@ -879,8 +872,6 @@
 
                function add($location='',$values_attribute='',$type_id='')
                {
-                       $location['remark'] = 
$this->db->db_addslashes($location['remark']);
-
                        while (is_array($location) && list($input_name,$value) 
= each($location))
                        {
                                if($value)
@@ -900,6 +891,11 @@
                                {
                                        if($entry['value'])
                                        {
+                                               if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V')
+                                               {
+                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                               }
+
                                                $cols[] = $entry['name'];
                                                $vals[] = $entry['value'];
                                        }
@@ -922,8 +918,6 @@
                function edit($location='',$values_attribute='',$type_id='')
                {
 //_debug_array($values_attribute);
-                       $location['remark'] = 
$this->db->db_addslashes($location['remark']);
-
                        while (is_array($location) && list($input_name,$value) 
= each($location))
                        {
                                if($value)
@@ -940,6 +934,10 @@
                        {
                                foreach($values_attribute as $entry)
                                {
+                                       if($entry['datatype'] == 'C' || 
$entry['datatype'] == 'T' || $entry['datatype'] == 'V')
+                                       {
+                                               $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                       }
                                        $value_set[$entry['name']]      = 
$entry['value'];
                                }
                        }

Index: inc/class.uiadmin_location.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.uiadmin_location.inc.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- inc/class.uiadmin_location.inc.php  14 Sep 2006 13:53:52 -0000      1.17
+++ inc/class.uiadmin_location.inc.php  3 Oct 2006 09:58:09 -0000       1.18
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage admin
-       * @version $Id: class.uiadmin_location.inc.php,v 1.17 2006/09/14 
13:53:52 sigurdne Exp $
+       * @version $Id: class.uiadmin_location.inc.php,v 1.18 2006/10/03 
09:58:09 sigurdne Exp $
        */
 
        /**
@@ -100,7 +100,6 @@
                                (
                                        'id'                            => 
$standard['id'],
                                        'name'                          => 
$standard['name'],
-                                       'prefix'                        => 
$standard['prefix'],
                                        'first'                         => 
$standard['descr'],
                                        'link_categories'               => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
$this->currentapp.'.uicategory.index', 'type'=>'location', 'type_id'=> 
$standard['id'])),
                                        'link_attribute'                => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
$this->currentapp.'.uiadmin_location.list_attribute', 'type_id'=> 
$standard['id'])),
@@ -124,7 +123,6 @@
                        (
 
                                'lang_descr'            => lang('Descr'),
-                               'lang_prefix'           => lang('prefix'),
                                'lang_categories'       => lang('Categories'),
                                'lang_attribute'        => lang('Attributes'),
                                'lang_edit'             => lang('edit'),
@@ -157,9 +155,13 @@
                                'done_action'           => 
$GLOBALS['phpgw']->link('/admin/index.php')
                        );
 
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp);
+                       
$GLOBALS['phpgw']->session->appsession('receipt',$this->currentapp,'');
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $data = array
                        (
+                               'msgbox_data'                                   
=> $msgbox_data,
                                'links'                                         
=> $links,
                                'allow_allrows'                                 
=> False,
                                'start_record'                                  
=> $this->start,
@@ -198,9 +200,9 @@
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_location'));
 
-                       if ($values['save'])
+                       if (isset($values['save']))
                        {
-                               if (!$values['name'])
+                               if (!isset($values['name']) || !$values['name'])
                                {
                                        $receipt['error'][] = 
array('msg'=>lang('Name not entered!'));
                                }
@@ -208,18 +210,13 @@
                                if($id)
                                {
                                        $values['id']=$id;
-                                       $action='edit';
                                }
 
-                               if (!$receipt['error'])
-                               {
-
-                                       $receipt = 
$this->bo->save($values,$action);
-                                       if(!$id)
+                               if (!isset($receipt['error']))
                                        {
+                                       $receipt = $this->bo->save($values);
                                                $id=$receipt['id'];
                                        }
-                               }
                                else
                                {
                                        $receipt['error'][] = array('msg'=> 
lang('Table has NOT been saved'));
@@ -245,17 +242,14 @@
                                'menuaction'    => 
$this->currentapp.'.uiadmin_location.edit',
                                'id'    => $id
                        );
-//_debug_array($link_data);
+//_debug_array($values);
 
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
 
                        $data = array
                        (
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'lang_prefix'                           => 
lang('Standard prefix'),
-                               'lang_prefix_standardtext'              => 
lang('Enter a standard prefix for the id'),
                                'lang_name_standardtext'                => 
lang('Enter a name of the standard'),
-
                                'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
$this->currentapp.'.uiadmin_location.index')),
                                'lang_id'                               => 
lang('standard ID'),
@@ -263,15 +257,13 @@
                                'lang_descr'                            => 
lang('Descr'),
                                'lang_save'                             => 
lang('save'),
                                'lang_done'                             => 
lang('done'),
-                               'value_id'                              => $id,
-                               'value_name'                            => 
$values['name'],
-                               'value_prefix'                          => 
$values['prefix'],
+                               'value_id'                              => 
(isset($id)?$id:''),
+                               'value_name'                            => 
(isset($values['name'])?$values['name']:''),
                                'lang_id_standardtext'                  => 
lang('Enter the standard ID'),
                                'lang_descr_standardtext'               => 
lang('Enter a description of the standard'),
                                'lang_done_standardtext'                => 
lang('Back to the list'),
                                'lang_save_standardtext'                => 
lang('Save the standard'),
-                               'type_id'                               => 
$values['type_id'],
-                               'value_descr'                           => 
$values['descr']
+                               'value_descr'                           => 
(isset($values['descr'])?$values['descr']:'')
                        );
 
                        $appname                                        = 
lang('location');
@@ -307,7 +299,7 @@
                                'type_id' => $type_id
                        );
 
-                       if (get_var('confirm',array('POST')))
+                       if ($confirm)
                        {
                                $this->bo->delete($type_id,$id,$attrib);
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
@@ -688,7 +680,6 @@
                                (
                                        'column_name'                   => 
$standard['column_name'],
                                        'name'                          => 
$standard['location_name'],
-                                       'prefix'                        => 
$standard['prefix'],
                                        'link_edit'                     => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
$this->currentapp.'.uiadmin_location.edit_config', 'column_name'=> 
$standard['column_name'])),
                                        'lang_edit_standardtext'        => 
lang('edit the column relation'),
                                        'text_edit'                     => 
lang('edit')

Index: inc/class.uilocation.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.uilocation.inc.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- inc/class.uilocation.inc.php        20 Sep 2006 08:41:47 -0000      1.34
+++ inc/class.uilocation.inc.php        3 Oct 2006 09:58:09 -0000       1.35
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage location
-       * @version $Id: class.uilocation.inc.php,v 1.34 2006/09/20 08:41:47 
sigurdne Exp $
+       * @version $Id: class.uilocation.inc.php,v 1.35 2006/10/03 09:58:09 
sigurdne Exp $
        */
 
        /**
@@ -582,7 +582,7 @@
                                        $location_code=$values['location_code'];
                                }
 
-                               if(!$receipt['error'])
+                               if(!isset($receipt['error']))
                                {
                                        $receipt = 
$this->bo->save($values,$values_attribute,$action,$type_id,$location_parent);
                                }

Index: setup/default_records.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/setup/default_records.inc.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- setup/default_records.inc.php       1 Oct 2006 21:09:49 -0000       1.26
+++ setup/default_records.inc.php       3 Oct 2006 09:58:09 -0000       1.27
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage setup
-       * @version $Id: default_records.inc.php,v 1.26 2006/10/01 21:09:49 
sigurdne Exp $
+       * @version $Id: default_records.inc.php,v 1.27 2006/10/03 09:58:09 
sigurdne Exp $
        */
 
 
@@ -442,14 +442,9 @@
 
 
 #
-# Dumping data for table fm_location_type
+# Data for table fm_location_type
 #
 
-#$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_type (id, 
name, descr) VALUES (1, 'property', 'Property')");
-#$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_type (id, 
name, descr) VALUES (2, 'building', 'Building')");
-#$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_type (id, 
name, descr) VALUES (3, 'entrance', 'Entrance')");
-#$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_type (id, 
name, descr) VALUES (4, 'apartment', 'Apartment')");
-
 $location_naming[1]['name']='property';
 $location_naming[1]['descr']='Property';
 $location_naming[2]['name']='building';
@@ -589,13 +584,13 @@
 #
 
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (1, 8, 1, 'OK')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (1, 8, 2, 'Not Active')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (1, 8, 2, 'Not OK')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (2, 9, 1, 'OK')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (2, 9, 2, 'Not Active')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (2, 9, 2, 'Not OK')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (3, 10, 1, 'OK')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (3, 10, 2, 'Not Active')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (3, 10, 2, 'Not OK')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (4, 11, 1, 'OK')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (4, 11, 2, 'Not Active')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO fm_location_choice ( 
type_id, attrib_id, id, value) VALUES (4, 11, 2, 'Not OK')");
 
 
 ?>

Index: setup/tables_current.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/setup/tables_current.inc.php,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- setup/tables_current.inc.php        10 May 2006 11:10:21 -0000      1.63
+++ setup/tables_current.inc.php        3 Oct 2006 09:58:09 -0000       1.64
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage setup
-       * @version $Id: tables_current.inc.php,v 1.63 2006/05/10 11:10:21 
sigurdne Exp $
+       * @version $Id: tables_current.inc.php,v 1.64 2006/10/03 09:58:09 
sigurdne Exp $
        */
 
        $phpgw_baseline = array(
@@ -208,7 +208,6 @@
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
                                'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => True),
                                'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
-                               'prefix' => array('type' => 
'varchar','precision' => '8','nullable' => True),
                                'pk' => array('type' => 'text','nullable' => 
True),
                                'ix' => array('type' => 'text','nullable' => 
True),
                                'uc' => array('type' => 'text','nullable' => 
True),

Index: templates/base/admin_location.xsl
===================================================================
RCS file: /sources/phpgroupware/property/templates/base/admin_location.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- templates/base/admin_location.xsl   17 Jan 2005 10:03:18 -0000      1.1
+++ templates/base/admin_location.xsl   3 Oct 2006 09:58:09 -0000       1.2
@@ -1,4 +1,4 @@
-<!-- $Id: admin_location.xsl,v 1.1 2005/01/17 10:03:18 sigurdne Exp $ -->
+<!-- $Id: admin_location.xsl,v 1.2 2006/10/03 09:58:09 sigurdne Exp $ -->
 
        <xsl:template name="app_data">
                <xsl:choose>
@@ -22,11 +22,18 @@
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
-       
-
        <xsl:template match="list">             
                <xsl:call-template name="menu"/> 
                <table width="100%" cellpadding="2" cellspacing="2" 
align="center">
+                       <xsl:choose>
+                               <xsl:when test="msgbox_data != ''">
+                                       <tr>
+                                               <td align="left" colspan="3">
+                                                       <xsl:call-template 
name="msgbox"/>
+                                               </td>
+                                       </tr>
+                               </xsl:when>
+                       </xsl:choose>
                        <tr>
                                <td align="right">
                                        <xsl:call-template name="search_field"/>




reply via email to

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