phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.sopricebook.inc.php,1.6.2.7


From: sigurdne
Subject: [Phpgroupware-cvs] property/inc class.sopricebook.inc.php,1.6.2.7
Date: Thu, 24 Feb 2005 14:46:40 -0000

Update of property/inc

Modified Files:
     Branch: proposed-0_9_18-branch
            class.sopricebook.inc.php lines: +58 -36

Log Message:
no message

====================================================
Index: property/inc/class.sopricebook.inc.php
diff -u property/inc/class.sopricebook.inc.php:1.6.2.6 
property/inc/class.sopricebook.inc.php:1.6.2.7
--- property/inc/class.sopricebook.inc.php:1.6.2.6      Tue Dec  7 09:04:28 2004
+++ property/inc/class.sopricebook.inc.php      Thu Jan 13 11:37:34 2005
@@ -34,10 +34,10 @@
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
+                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');

-                       $this->join                     = $this->socommon->join;
-                       $this->like                     = $this->socommon->like;
+                       $this->join                     = $this->bocommon->join;
+                       $this->like                     = $this->bocommon->like;
                }

                function 
add_activity_first_prize($m_cost,$w_cost,$total_cost,$activity_id,$vendor_id,$date)
@@ -574,13 +574,13 @@
                                $querymethod = " AND (fm_vendor.org_name 
$this->like '%$query%' or vendor_id $this->like '%$query%')";
                        }

-                       $sql = "SELECT fm_activities.id as 
activity_id,fm_activities.num, fm_vendor.org_name,fm_branch.descr as branch 
,vendor_id "
+                       $sql = "SELECT fm_activities.id as 
activity_id,fm_activities.num, fm_vendor.org_name,fm_branch.descr as branch 
,fm_activity_price_index.vendor_id "
                                . " FROM (fm_activities  $this->join 
fm_activity_price_index ON fm_activities.id = 
fm_activity_price_index.activity_id) "
                                . " $this->join fm_agreement ON 
fm_activity_price_index.agreement_id = fm_agreement.id "
                                . " $this->join fm_vendor ON 
fm_agreement.vendor_id = fm_vendor.id "
                                . " $this->join fm_branch on fm_branch.id = 
fm_activities.branch_id "
                                . " Where fm_activity_price_index.activity_id= 
'$activity_id' $querymethod group by fm_activities.id,fm_activities.num,"
-                               . " fm_branch.descr,org_name ,vendor_id ";
+                               . " fm_branch.descr,org_name 
,fm_activity_price_index.vendor_id ";

                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -652,17 +652,24 @@
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
                        $values['base_descr'] = 
$this->db->db_addslashes($values['base_descr']);

+                       $vals= array(
+                               $values['activity_id'],
+                               $values['num'] ,
+                               $values['unit'] ,
+                               $values['cat_id'] , // agreement_group
+                               $values['ns3420_id'] ,
+                               $values['dim_d'],
+                               $values['branch_id'],
+                               $values['descr'],
+                               $values['base_descr']
+                               );
+
+                       $vals   = $this->bocommon->validate_db_insert($vals);
+
+                       $this->db->transaction_begin();
                        $this->db->query("INSERT INTO fm_activities (id, 
num,unit,agreement_group_id,ns3420,dim_d,branch_id,descr,base_descr) "
-                               . "VALUES ('" .
-                               $values['activity_id']. "','" .
-                               $values['num'] . "','" .
-                               $values['unit'] . "','" .
-                               $values['cat_id'] . "','" . // agreement_group
-                               $values['ns3420_id'] . "','" .
-                               $values['dim_d']        . "','" .
-                               $values['branch_id'] ."','" .
-                               $values['descr'] ."','" .
-                               $values['base_descr']. "')",__LINE__,__FILE__);
+                               . "VALUES ($vals)",__LINE__,__FILE__);
+                       $this->db->transaction_commit();

                        $receipt['message'][] = array('msg'=>lang('Activity has 
been saved'));
                        $receipt['activity_id']= $values['activity_id'];
@@ -674,16 +681,21 @@
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
                        $values['base_descr'] = 
$this->db->db_addslashes($values['base_descr']);

-                       $this->db->query("UPDATE fm_activities set
-                               num='" . $values['num'] . "',
-                               unit='" . $values['unit'] . "',
-                               agreement_group_id='" . $values['cat_id'] . "',
-                               ns3420='" . $values['ns3420_id'] . "',
-                               dim_d='" . $values['dim_d'] . "',
-                               branch_id='" . $values['branch_id'] . "',
-                               descr='" . $values['descr'] . "',
-                               base_descr='" . $values['base_descr']
-                               . "' WHERE id= '" . $values['activity_id'] . 
"'",__LINE__,__FILE__);
+                       $value_set=array(
+                               'num'                                   => 
$values['num'],
+                               'unit'                                  => 
$values['unit'],
+                               'agreement_group_id'    => $values['cat_id'],
+                               'ns3420'                                => 
$values['ns3420_id'],
+                               'dim_d'                                 => 
$values['dim_d'],
+                               'branch_id'                             => 
$values['branch_id'],
+                               'descr'                                 => 
$values['descr'],
+                               'base_descr'                    => 
$values['base_descr']
+                               );
+
+                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $this->db->transaction_begin();
+                       $this->db->query("UPDATE fm_activities set $value_set 
WHERE id= '" . $values['activity_id'] . "'",__LINE__,__FILE__);
+                       $this->db->transaction_commit();

                        $receipt['activity_id']= $values['activity_id'];
                        $receipt['message'][] = array('msg'=>lang('Activity has 
been edited'));
@@ -694,12 +706,15 @@
                {
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);

+                       $vals= array(
+                               $values['agreement_group_id'],
+                               $values['num'],
+                               $values['status'],
+                               $values['descr']
+                               );
+
                        $this->db->query("INSERT INTO fm_agreement_group 
(id,num,status,descr) "
-                               . "VALUES ('" .
-                               $values['agreement_group_id']. "','" .
-                               $values['num'] . "','" .
-                               $values['status'] . "','" .
-                               $values['descr']. "')",__LINE__,__FILE__);
+                               . "VALUES ($vals)",__LINE__,__FILE__);

                        $receipt['message'][] = array('msg'=>lang('Agreement 
group has been saved'));
                        $receipt['agreement_group_id'] = 
$values['agreement_group_id'];
@@ -710,11 +725,18 @@
                {
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);

-                       $this->db->query("UPDATE fm_agreement_group set
-                               num='" . $values['num'] . "',
-                               status='"       . $values['status'] . "',
-                               descr='" . $values['descr']
-                               . "' WHERE id= '" . 
$values['agreement_group_id'] . "'",__LINE__,__FILE__);
+                       $value_set=array(
+                               'num'   => $values['num'],
+                               'status'=> $values['status'],
+                               'descr' => $values['descr']
+                               );
+
+                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $this->db->transaction_begin();
+
+                       $this->db->query("UPDATE fm_agreement_group set 
$value_set WHERE id= '" . $values['agreement_group_id'] . 
"'",__LINE__,__FILE__);
+
+                       $this->db->transaction_commit();

                        $receipt['message'][] = 
array('msg'=>lang('Agreement_group has been edited'));
                        return $receipt;






reply via email to

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