[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: commande.class.php,v 1.9 2005/07/09 14:34:44 eldy Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/boutique/commande/commande.class.php,v $ 20 * 21 */ 22 23 require_once(DOL_DOCUMENT_ROOT ."/address.class.php"); 24 25 26 class Commande { 27 var $db ; 28 29 var $id ; 30 var $nom; 31 32 function Commande($DB, $id=0) { 33 $this->db = $DB; 34 $this->id = $id ; 35 36 $this->billing_adr = New Address(); 37 $this->delivry_adr = New Address(); 38 39 $this->total_ot_subtotal = 0; 40 $this->total_ot_shipping = 0; 41 } 42 /* 43 * 44 * 45 * 46 */ 47 function fetch ($id) { 48 49 $sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, ".$this->db->pdate("date_purchased") . " as date_purchased, orders_status, orders_date_finished, currency, currency_value"; 50 51 52 $sql .= " FROM ".OSC_DB_NAME.".orders WHERE orders_id = $id"; 53 54 $result = $this->db->query($sql) ; 55 56 if ( $result ) 57 { 58 $array = $this->db->fetch_array(); 59 60 $this->id = $array["orders_id"]; 61 $this->client_id = stripslashes($array["customers_id"]); 62 $this->client_name = stripslashes($array["customers_name"]); 63 64 $this->payment_method = stripslashes($array["payment_method"]); 65 66 $this->date = strftime("%d/%m/%Y %H:%M",$array["date_purchased"]); 67 68 $this->delivery_adr->name = stripslashes($array["delivery_name"]); 69 $this->delivery_adr->street = stripslashes($array["delivery_street_address"]); 70 $this->delivery_adr->cp = stripslashes($array["delivery_postcode"]); 71 $this->delivery_adr->city = stripslashes($array["delivery_city"]); 72 $this->delivery_adr->country = stripslashes($array["delivery_country"]); 73 74 $this->billing_adr->name = stripslashes($array["billing_name"]); 75 $this->billing_adr->street = stripslashes($array["billing_street_address"]); 76 $this->billing_adr->cp = stripslashes($array["billing_postcode"]); 77 $this->billing_adr->city = stripslashes($array["billing_city"]); 78 $this->billing_adr->country = stripslashes($array["billing_country"]); 79 80 $this->db->free(); 81 82 /* 83 * Totaux 84 */ 85 $sql = "SELECT value, class "; 86 $sql .= " FROM ".OSC_DB_NAME.".orders_total WHERE orders_id = $id"; 87 88 $result = $this->db->query($sql) ; 89 90 if ( $result ) 91 { 92 $num = $this->db->num_rows(); 93 94 while ($i < $num) 95 { 96 $array = $this->db->fetch_array($i); 97 if ($array["class"] == 'ot_total') 98 { 99 $this->total_ot_total = $array["value"]; 100 } 101 if ($array["class"] == 'ot_shipping') 102 { 103 $this->total_ot_shipping = $array["value"]; 104 } 105 $i++; 106 } 107 } 108 else 109 { 110 print $this->db->error(); 111 } 112 113 } 114 else 115 { 116 print $this->db->error(); 117 } 118 119 return $result; 120 } 121 122 } 123 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |