-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXeroAccount.php
75 lines (57 loc) · 1.76 KB
/
XeroAccount.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
class XeroAccount {
//ATTRIBUTES
public $_title = 'Account';
public $_pk = 'xeroAccountID'; //our primary key title
protected $_table = 'xeroaccount'; //MySQL table name
//OUR FIELDS
public $xeroAccountID = ''; //Our primary Key
public $userID = 0;
//XERO Fields
public $AccountID; //Xero's primary key
public $Name;
public $Type;
public $TaxType;
public $Description;
public $EnablePaymentsToAccount;
public $Status;
function __construct($dataarray,$userID)
{
// Intitlize all the variable
// print_r($dataarray);
foreach($dataarray->Account as $row)
{
$this->AccountID=$row->AccountID;
$this->Name=$row->Name;
$this->Type=$row->Type;
$this->TaxType=$row->TaxType;
$this->Description=$row->Description;
$this->EnablePaymentsToAccount=$row->EnablePaymentsToAccount;
$this->Status=$row->Status;
//echo $this->AccountID."<br> sdfsdsd ";
$this->insert();
}
return true;
}
//CRUD
public function insert(){
$insert = sprintf("INSERT INTO ".$this->_table."
(userID, AccountID, Name, Type,TaxType,Description, EnablePaymentsToAccount,Status )
VALUES
('%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s');",
mysql_real_escape_string($this->userID),
mysql_real_escape_string($this->AccountID),
mysql_real_escape_string($this->Name),
mysql_real_escape_string($this->Type),
mysql_real_escape_string($this->TaxType),
mysql_real_escape_string($this->Description),
mysql_real_escape_string($this->EnablePaymentsToAccount),
mysql_real_escape_string($this->Status)
);
$result = mysql_query($insert);
}
/*
Any other utilities you need here
*/
}
?>