Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezvattype.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezvattype.php 7626 2001-10-02 07:59:01Z ce $
5 //
6 // Definition of eZVATType class
7 //
8 // Created on: <19-Feb-2001 13:41:53 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
29
32
36 // include_once( "classes/ezdb.php" );
37 // include_once( "classes/ezdatetime.php" );
38 // include_once( "eztrade/classes/ezproducttype.php" );
39
40 class eZVATType
41 {
45 function __construct( $id=-1 )
46 {
47 $this->VATValue = 0;
48 if ( $id != -1 )
49 {
50 $this->ID = $id;
51 $this->get( $this->ID );
52 }
53 }
54
58 function store()
59 {
60 $db =& eZDB::globalDatabase();
61 $db->begin();
62
63 $this->Name = $db->escapeString( $this->Name );
64
65 if ( !isset( $this->ID ) )
66 {
67 $timeStamp =& (new eZDateTime())->timeStamp( true );
68 $db->lock( "eZTrade_VATType" );
69 $nextID = $db->nextID( "eZTrade_VATType", "ID" );
70 $ret[] = $db->query( "INSERT INTO eZTrade_VATType
71 ( ID,
72 Name,
73 VATValue,
74 Created )
75 VALUES
76 ( '$nextID',
77 '$this->Name',
78 '$this->VATValue',
79 '$timeStamp' )" );
80 $db->unlock();
81 $this->ID = $nextID;
82 }
83 else
84 {
85 $ret[] = $db->query( "UPDATE eZTrade_VATType SET
86 Name='$this->Name',
87 VATValue='$this->VATValue',
88 Created=Created
89 WHERE ID='$this->ID'" );
90 }
91 eZDB::finish( $ret, $db );
92 return true;
93 }
94
98 function get( $id=-1 )
99 {
100 $db =& eZDB::globalDatabase();
101
102 if ( $id != -1 )
103 {
104 $db->array_query( $vat_array, "SELECT * FROM eZTrade_VATType WHERE ID='$id'" );
105
106 if ( count( $vat_array ) > 1 )
107 {
108 die( "Error: VAT Types's with the same ID was found in the database. This shouldent happen." );
109 }
110 else if( count( $vat_array ) == 1 )
111 {
112 $this->ID =& $vat_array[0][$db->fieldName("ID")];
113 $this->Name =& $vat_array[0][$db->fieldName("Name")];
114 $this->VATValue =& $vat_array[0][$db->fieldName("VATValue")];
115 }
116 }
117 }
118
122 function &getAll()
123 {
124 $db =& eZDB::globalDatabase();
125
126 $return_array = array();
127 $vat_array = array();
128
129 $db->array_query( $vat_array, "SELECT ID FROM eZTrade_VATType ORDER BY Created" );
130
131 for ( $i=0; $i<count($vat_array); $i++ )
132 {
133 $return_array[$i] = new eZVATType( $vat_array[$i][$db->fieldName("ID")], 0 );
134 }
135
136 return $return_array;
137 }
138
142 function delete()
143 {
144 $db =& eZDB::globalDatabase();
145 $db->begin();
146 $ret[] = $db->query( "DELETE FROM eZTrade_VATType WHERE ID='$this->ID'" );
147 eZDB::finish( $ret, $db );
148 }
149
153 function id()
154 {
155 return $this->ID;
156 }
157
161 function name()
162 {
163 return $this->Name;
164 }
165
166
170 function &value()
171 {
172 return $this->VATValue;
173 }
174
175
179 function setName( $value )
180 {
181 $this->Name = $value;
182 }
183
187 function setValue( $value )
188 {
189 $this->VATValue = $value;
190 }
191
192 var $ID;
193 var $Name;
194 var $VATValue;
195
196 }
197
198 ?>
$i
$i
Definition: admin/adlist.php:91
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZDateTime
Definition: ezdatetime.php:55
eZVATType
Definition: ezvattype.php:41
eZVATType\$ID
$ID
Definition: ezvattype.php:192
eZVATType\$Name
$Name
Definition: ezvattype.php:193
eZVATType\id
id()
Definition: ezvattype.php:153
eZVATType\getAll
& getAll()
Definition: ezvattype.php:122
eZVATType\setName
setName( $value)
Definition: ezvattype.php:179
eZVATType\name
name()
Definition: ezvattype.php:161
eZVATType\$VATValue
$VATValue
Definition: ezvattype.php:194
eZVATType\value
& value()
Definition: ezvattype.php:170
eZVATType\store
store()
Definition: ezvattype.php:58
eZVATType\setValue
setValue( $value)
Definition: ezvattype.php:187
eZVATType\__construct
__construct( $id=-1)
Definition: ezvattype.php:45
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
Name
if($user) if(isset( $next) && $next)<?=isset($all_fields_error) &&$all_fields_error ?><?=isset($password_error) &&$password_error ?></p ><? endif;?>< form method="post">< table border="0" cellspacing="2" cellpadding="2" class="boxtext" style="font-size=13;">< tr >< td style="color:<?= isset( $error['first_name'] ) ?> First Name
Definition: step1.php:127
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.