[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Created on: <05-Dec-2002 09:12:43 bf> 4 // 5 // SOFTWARE NAME: eZ publish 6 // SOFTWARE RELEASE: 3.9.0 7 // BUILD VERSION: 17785 8 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 9 // SOFTWARE LICENSE: GNU General Public License v2.0 10 // NOTICE: > 11 // This program is free software; you can redistribute it and/or 12 // modify it under the terms of version 2.0 of the GNU General 13 // Public License as published by the Free Software Foundation. 14 // 15 // This program is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of version 2.0 of the GNU General 21 // Public License along with this program; if not, write to the Free 22 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 // MA 02110-1301, USA. 24 // 25 // 26 27 /*! 28 \class eZOrderItem ezorderitem.php 29 \brief eZOrderItem handles custom order items 30 \ingroup eZKernel 31 32 Custom order items are used to automatically add new items to 33 a specific order. You can use it to e.g. specify shipping and 34 handling, special discount or wrapping costs. 35 36 The order items is different from the product collection items 37 in the way that there is no product for each order item. 38 39 \sa eZProductCollection eZBasket eZOrder 40 */ 41 42 include_once ( "kernel/classes/ezpersistentobject.php" ); 43 include_once ( "kernel/classes/ezvattype.php" ); 44 45 class eZOrderItem extends eZPersistentObject 46 { 47 function eZOrderItem( $row ) 48 { 49 $this->eZPersistentObject( $row ); 50 } 51 52 function definition() 53 { 54 return array( "fields" => array( 'id' => array( 'name' => 'ID', 55 'datatype' => 'integer', 56 'default' => 0, 57 'required' => true ), 58 'order_id' => array( 'name' => 'OrderID', 59 'datatype' => 'integer', 60 'default' => 0, 61 'required' => true, 62 'foreign_class' => 'eZOrder', 63 'foreign_attribute' => 'id', 64 'multiplicity' => '1..*' ), 65 'description' => array( 'name' => 'Description', 66 'datatype' => 'string', 67 'default' => '', 68 'required' => true ), 69 'price' => array( 'name' => 'Price', 70 'datatype' => 'float', 71 'default' => 0, 72 'required' => true ), 73 'vat_value' => array( 'name' => 'VATValue', 74 'datatype' => 'integer', 75 'default' => 0, 76 'required' => true ), 77 'is_vat_inc' => array( 'name' => 'IsVATIncluded', 78 'datatype' => 'integer', 79 'default' => 0, 80 'required' => true ), 81 'type' => array( 'name' => 'Type', 82 'datatype' => 'string', 83 'required' => false ) ), 84 'keys' => array( 'id' ), 85 'function_attributes' => array( 'vat_value' => 'vatValue', 86 'price_inc_vat' => 'priceIncVat', 87 'price_ex_vat' => 'priceExVAT' ), 88 'increment_key' => 'id', 89 'class_name' => 'eZOrderItem', 90 'name' => 'ezorder_item' ); 91 } 92 93 function fetchList( $orderID, $asObject = true ) 94 { 95 $returnValue = eZPersistentObject::fetchObjectList( eZOrderItem::definition(), 96 null, 97 array( "order_id" => $orderID ), 98 null, 99 null, 100 $asObject ); 101 return $returnValue; 102 } 103 104 function fetchListByType( $orderID, $itemType, $asObject = true ) 105 { 106 return eZPersistentObject::fetchObjectList( eZOrderItem::definition(), 107 null, 108 array( 'order_id' => $orderID, 'type' => $itemType ), 109 null, 110 null, 111 $asObject ); 112 113 } 114 115 function &vatValue() 116 { 117 return $this->VATValue; 118 } 119 120 function &priceIncVAT() 121 { 122 if ( $this->attribute( 'is_vat_inc' ) == 1 ) 123 { 124 return $this->Price; 125 } 126 else 127 { 128 $incVATPrice = $this->Price * ( $this->vatValue() + 100 ) / 100; 129 return $incVATPrice; 130 } 131 132 } 133 134 function &priceExVAT() 135 { 136 if ( $this->attribute( 'is_vat_inc' ) == 1 ) 137 { 138 $exVATPrice = $this->Price / ( $this->vatValue() + 100 ) * 100; 139 return $exVATPrice; 140 } 141 else 142 return $this->Price; 143 144 } 145 146 /*! 147 \static 148 Removes all order items from the database. 149 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 150 the calls within a db transaction; thus within db->begin and db->commit. 151 */ 152 function cleanup() 153 { 154 $db =& eZDB::instance(); 155 $db->query( "DELETE FROM ezorder_item" ); 156 } 157 } 158 159 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |