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.4


From: nomail
Subject: [Phpgroupware-cvs] property/inc/class.sopricebook.inc.php, 1.4
Date: Fri, 20 Aug 2004 17:15:21 +0200

Update of /property/inc
Modified Files:
        Branch: 
          class.sopricebook.inc.php

date: 2004/08/20 15:15:21;  author: sigurdne;  state: Exp;  lines: +59 -48

Log Message:
no message
=====================================================================
Index: property/inc/class.sopricebook.inc.php
diff -u property/inc/class.sopricebook.inc.php:1.3 
property/inc/class.sopricebook.inc.php:1.4
--- property/inc/class.sopricebook.inc.php:1.3  Thu Jun  3 18:15:27 2004
+++ property/inc/class.sopricebook.inc.php      Fri Aug 20 15:15:21 2004
@@ -70,11 +70,10 @@
                function get_vendor_list()
                {
                        $this->db->query("SELECT fm_vendor.org_name ,vendor_id "
-                               . " FROM (fm_activities $this->join 
fm_activity_price_index ON fm_activities.id = 
fm_activity_price_index.activity_id) $this->join fm_vendor ON 
fm_activity_price_index.vendor_id = fm_vendor.id "
-                               . " $this->join fm_agreement ON 
fm_activities.agreement_id = fm_agreement.id "
+                               . " FROM fm_agreement $this->join fm_vendor ON 
fm_agreement.vendor_id = fm_vendor.id "
                                . " WHERE fm_agreement.status='active'"
                                . " GROUP by fm_vendor.org_name ,vendor_id "
-                               . " ORDER BY fm_vendor.org_name ");
+                               . " ORDER BY fm_vendor.org_name 
",__LINE__,__FILE__);
                                while ($this->db->next_record())
                                {
 //--------->fix this------->
@@ -90,18 +89,18 @@
                        return $vendor_list;
                }
 
-               function get_agreement_list()
+               function get_agreement_group_list()
                {
-                       $this->db->query("SELECT * FROM fm_agreement ORDER BY 
descr asc");
+                       $this->db->query("SELECT * FROM fm_agreement_group 
ORDER BY descr asc");
                        while ($this->db->next_record())
                        {
-                               $agreement_list[]=array
+                               $agreement_group_list[]=array
                                (
                                        'id'    => $this->db->f('id'),
                                        'name'  => 
$GLOBALS['phpgw']->strip_html($this->db->f('descr')).' [ '. 
$GLOBALS['phpgw']->strip_html($this->db->f('status')).' ] '
                                );
                        }
-                       return $agreement_list;
+                       return $agreement_group_list;
                }
 
                function get_dim_d_list()
@@ -146,9 +145,9 @@
                        return $branch_list;
                }
 
-               function check_activity_num($num='',$agreement_id='')
+               function check_activity_num($num='',$agreement_group_id='')
                {
-                       $this->db->query("SELECT count(*) FROM fm_activities 
where num='$num' and agreement_id ='$agreement_id'");
+                       $this->db->query("SELECT count(*) FROM fm_activities 
where num='$num' and agreement_group_id ='$agreement_group_id'");
 
                        $this->db->next_record();
 
@@ -158,9 +157,9 @@
                        }
                }
 
-               function check_agreement_num($num='')
+               function check_agreement_group_num($num='')
                {
-                       $this->db->query("SELECT count(*) FROM fm_agreement 
where num='$num'");
+                       $this->db->query("SELECT count(*) FROM 
fm_agreement_group where num='$num'");
 
                        $this->db->next_record();
 
@@ -218,12 +217,19 @@
                                $querymethod = " AND (fm_activities.descr LIKE 
'%$query%' or fm_activities.num LIKE '%$query%')";
                        }
 
-                       $sql = "SELECT 
fm_activities.num,fm_activities.unit,fm_activities.dim_d,fm_activities.ns3420,fm_activities.descr
 as descr, fm_activities.base_descr,activity_id, 
fm_vendor.org_name,fm_branch.descr as branch 
,vendor_id,total_cost,m_cost,w_cost,index_count,fm_activity_price_index.this_index
 "
+/*                     $sql = "SELECT 
fm_activities.num,fm_activities.unit,fm_activities.dim_d,fm_activities.ns3420,fm_activities.descr
 as descr, fm_activities.base_descr,activity_id, 
fm_vendor.org_name,fm_branch.descr as branch 
,vendor_id,total_cost,m_cost,w_cost,index_count,fm_activity_price_index.this_index
 "
                                . " FROM (fm_activities  $this->join 
fm_activity_price_index ON fm_activities.id = 
fm_activity_price_index.activity_id) $this->join fm_vendor ON 
fm_activity_price_index.vendor_id = fm_vendor.id "
                                . " $this->join fm_branch ON 
fm_activities.branch_id = fm_branch.id "
                                . " $this->join fm_agreement ON 
fm_activities.agreement_id = fm_agreement.id "
                                . " WHERE fm_agreement.status='active' AND 
(vendor_id $vendor_condition and current_index is not null "
                                . " OR (fm_activity_price_index.vendor_id 
$vendor_condition) AND (fm_activity_price_index.this_index IS NULL)) 
$querymethod";
+*/
+                       $sql = "SELECT 
fm_activities.num,fm_activities.unit,fm_activities.dim_d,fm_activities.ns3420,fm_activities.descr
 as descr, fm_activities.base_descr,activity_id, 
fm_vendor.org_name,fm_branch.descr as branch 
,vendor_id,total_cost,m_cost,w_cost,index_count,fm_activity_price_index.this_index
 "
+                               . " FROM (fm_activities  $this->join 
fm_activity_price_index ON fm_activities.id = 
fm_activity_price_index.activity_id) $this->join fm_vendor ON 
fm_agreement.vendor_id = fm_vendor.id "
+                               . " $this->join fm_branch ON 
fm_activities.branch_id = fm_branch.id "
+                               . " $this->join fm_agreement ON 
fm_activity_price_index.agreement_id = fm_agreement.id "
+                               . " WHERE fm_agreement.status='active' AND 
(vendor_id $vendor_condition and current_index is not null "
+                               . " OR (fm_agreement.vendor_id 
$vendor_condition) AND (fm_activity_price_index.this_index IS NULL)) 
$querymethod";
 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -261,7 +267,7 @@
                        return $pricebook;
                }
 
-               function read_agreement($data)
+               function read_agreement_group($data)
                {
                        if(is_array($data))
                        {
@@ -306,7 +312,7 @@
                                $querymethod = " $where (descr LIKE '%$query%' 
or num LIKE '%$query%')";
                        }
 
-                       $sql = "SELECT * FROM  fm_agreement $filtermethod 
$querymethod";
+                       $sql = "SELECT * FROM  fm_agreement_group $filtermethod 
$querymethod";
 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -322,16 +328,16 @@
 
                        while ($this->db->next_record())
                        {
-                               $agreement[] = array
+                               $agreement_group[] = array
                                (
-                                       'agreement_id'          => 
$this->db->f('id'),
+                                       'agreement_group_id'            => 
$this->db->f('id'),
                                        'num'                           => 
$this->db->f('num'),
                                        'status'                        => 
$this->db->f('status'),
                                        'descr'                         => 
stripslashes($this->db->f('descr'))
                                );
                        }
-//             _debug_array($agreement);
-                       return $agreement;
+//             _debug_array($agreement_group);
+                       return $agreement_group;
                }
 
                function select_status_list()
@@ -394,7 +400,8 @@
                        }
 
                        $sql = "SELECT 
index_count,this_index,current_index,m_cost,w_cost,total_cost,date"
-                               . " FROM fm_activity_price_index Where 
activity_id= '$activity_id' and vendor_id= '$vendor_id'";
+                               . " FROM fm_activity_price_index $this->join 
fm_agreement on fm_activity_price_index.agreement_id = fm_agreement.id "
+                               . " Where activity_id= '$activity_id' and 
vendor_id= '$vendor_id'";
 
 
                        $this->db2->query($sql,__LINE__,__FILE__);
@@ -426,7 +433,7 @@
                        return $pricebook;
                }
 
-               function read_activities_pr_aggreement($data)
+               function read_activities_pr_agreement_group($data)
                {
                        if(is_array($data))
                        {
@@ -457,11 +464,11 @@
 
                        if ($cat_id > 0)
                        {
-                               $filtermethod .= " Where agreement_id='$cat_id' 
";
+                               $filtermethod .= " Where 
agreement_group_id='$cat_id' ";
                        }
                        else
                        {
-                               $filtermethod = " Where agreement_id IS NULL";
+                               $filtermethod = " Where agreement_group_id IS 
NULL";
                        }
                        if($query)
                        {
@@ -476,6 +483,7 @@
                                . " FROM  fm_activities $this->join fm_branch 
on fm_activities.branch_id=fm_branch.id"
                                . " $filtermethod $querymethod ";
 
+
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
 
@@ -538,11 +546,11 @@
 
                        if ($cat_id > 0)
                        {
-                               $filtermethod .= " Where agreement_id='$cat_id' 
";
+                               $filtermethod .= " Where 
agreement_group_id='$cat_id' ";
                        }
                        else
                        {
-                               $filtermethod = " Where agreement_id = ''";
+                               $filtermethod = " Where agreement_group_id = 
''";
                        }
                        if($query)
                        {
@@ -553,9 +561,12 @@
                        }
 
                        $sql = "SELECT fm_activities.id as 
activity_id,fm_activities.num, fm_vendor.org_name,fm_branch.descr as branch 
,vendor_id "
-                               . " FROM (fm_activities  $this->join 
fm_activity_price_index ON fm_activities.id = 
fm_activity_price_index.activity_id)  $this->join fm_vendor ON 
fm_activity_price_index.vendor_id = fm_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 ";
+                               . " 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 ";
 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -594,7 +605,7 @@
                                $activity['activity_id']= $id;
                                $activity['num']                = 
$this->db->f('num');
                                $activity['unit']               = 
$this->db->f('unit');
-                               $activity['cat_id']             = 
$this->db->f('agreement_id');
+                               $activity['cat_id']             = 
$this->db->f('agreement_group_id');
                                $activity['ns3420_id']  = 
$this->db->f('ns3420');
                                $activity['descr']              = 
stripslashes($this->db->f('descr'));
                                $activity['base_descr'] = 
stripslashes($this->db->f('base_descr'));
@@ -605,20 +616,20 @@
                        }
                }
 
-               function read_single_agreement($id)
+               function read_single_agreement_group($id)
                {
-                       $sql = "SELECT * FROM fm_agreement where id='$id'";
+                       $sql = "SELECT * FROM fm_agreement_group where 
id='$id'";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        if ($this->db->next_record())
                        {
-                               $agreement['agreement_id']      = $id;
-                               $agreement['num']                       = 
$this->db->f('num');
-                               $agreement['status']            = 
$this->db->f('status');
-                               $agreement['descr']                     = 
stripslashes($this->db->f('descr'));
+                               $agreement_group['agreement_group_id']  = $id;
+                               $agreement_group['num']                 = 
$this->db->f('num');
+                               $agreement_group['status']              = 
$this->db->f('status');
+                               $agreement_group['descr']                       
= stripslashes($this->db->f('descr'));
 
-                               return $agreement;
+                               return $agreement_group;
                        }
                }
 
@@ -627,12 +638,12 @@
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
                        $values['base_descr'] = 
$this->db->db_addslashes($values['base_descr']);
 
-                       $this->db->query("INSERT INTO fm_activities (id, 
num,unit,agreement_id,ns3420,dim_d,branch_id,descr,base_descr) "
+                       $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
+                               $values['cat_id'] . "','" . // agreement_group
                                $values['ns3420_id'] . "','" .
                                $values['dim_d']        . "','" .
                                $values['branch_id'] ."','" .
@@ -652,7 +663,7 @@
                        $this->db->query("UPDATE fm_activities set
                                num='" . $values['num'] . "',
                                unit='" . $values['unit'] . "',
-                               agreement_id='" . $values['cat_id'] . "',
+                               agreement_group_id='" . $values['cat_id'] . "',
                                ns3420='" . $values['ns3420_id'] . "',
                                dim_d='" . $values['dim_d'] . "',
                                branch_id='" . $values['branch_id'] . "',
@@ -665,33 +676,33 @@
                        return $receipt;
                }
 
-               function add_agreement($values)
+               function add_agreement_group($values)
                {
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
 
-                       $this->db->query("INSERT INTO fm_agreement 
(id,num,status,descr) "
+                       $this->db->query("INSERT INTO fm_agreement_group 
(id,num,status,descr) "
                                . "VALUES ('" .
-                               $values['agreement_id']. "','" .
+                               $values['agreement_group_id']. "','" .
                                $values['num'] . "','" .
                                $values['status'] . "','" .
                                $values['descr']. "')",__LINE__,__FILE__);
 
-                       $receipt['message'][] = array('msg'=>lang('Agreement 
has been saved'));
-                       $receipt['agreement_id'] = $values['agreement_id'];
+                       $receipt['message'][] = array('msg'=>lang('Agreement 
group has been saved'));
+                       $receipt['agreement_group_id'] = 
$values['agreement_group_id'];
                        return $receipt;
                }
 
-               function edit_agreement($values)
+               function edit_agreement_group($values)
                {
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
 
-                       $this->db->query("UPDATE fm_agreement set
+                       $this->db->query("UPDATE fm_agreement_group set
                                num='" . $values['num'] . "',
                                status='"       . $values['status'] . "',
                                descr='" . $values['descr']
-                               . "' WHERE id= '" . $values['agreement_id'] . 
"'",__LINE__,__FILE__);
+                               . "' WHERE id= '" . 
$values['agreement_group_id'] . "'",__LINE__,__FILE__);
 
-                       $receipt['message'][] = array('msg'=>lang('Agreement 
has been edited'));
+                       $receipt['message'][] = 
array('msg'=>lang('Agreement_group has been edited'));
                        return $receipt;
                }
 
@@ -723,9 +734,9 @@
 
                }
 
-               function delete_agreement($agreement_id)
+               function delete_agreement_group($agreement_group_id)
                {
-                       $this->db->query("DELETE FROM fm_agreement WHERE 
id='$agreement_id'",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_agreement_group WHERE 
id='$agreement_group_id'",__LINE__,__FILE__);
 //how to handle the activities and vendors ...?
                }
 




reply via email to

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