ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilERPDebtor_none.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
32 require_once './Services/Payment/classes/class.ilERPDebtor.php';
33 require_once './Services/Payment/classes/class.ilERP_none.php';
34 
36 {
37 
38  const website = "http://www.ilias.dk";
39 
40  const senderEmail = "noreply@ilias.dk";
41  const senderName = "ILIAS ERP";
42 
43  public function __construct()
44  {
45 
46  }
47 
48 
49  public function getDebtorByNumber($number)
50  {
51  return true;
52  }
53 
54 
55  public function setDebtorGroup($number=1)
56  {
57 
58  }
59 
60 
61  public function createDebtor($number)
62  {
63  }
64 
65 
66  public function setEAN($ean)
67  {
68  }
69 
70 
71  public function createInvoice()
72  {
73  }
74 
75  public function createInvoiceLine($p, $d, $q, $u )
76  {
77  }
78 
79  public function bookInvoice()
80  {
81  }
82 
83  public function getProduct($procuet = null)
84  {
85  }
86 
87  public function getInvoicePDF($v)
88  {}
89 
90 
91 
92  public function getInvoiceNumber()
93  {
94  return $this->invoice_number;
95  }
96 
97  public function getName()
98  {
99  return $this->name;
100  }
101 
102  public function getEmail()
103  {
104  return $this->email;
105  }
106 
112  public function getAll()
113  {
114  $a['number'] = $this->number;
115  $a['name'] = $this->name;
116  $a['email'] = $this->email;
117  $a['address'] = $this->address;
118  $a['postalcode'] = $this->postalcode;
119  $a['city'] = $this->city;
120  $a['country'] = $this->country;
121  $a['ean'] = $this->ean;
122  $a['website'] = $this->website;
123  $a['dgh'] = $this->dgh;
124  $a['phone'] = $this->phone;
125  return $a;
126  }
127 
128 
132  public function setAll($values)
133  {
134  foreach ($values as $key => $value)
135  $this->$key = $value;
136  }
137 
138 
139 
140 
141 
142  public function saveInvoice($contens, $preview=true)
143  {
145  $fp = @fopen( $file, 'w+' );
146  if (!$fp)
147  {
148  throw new ilERPException("Cannot write " . $file);
149  }
150  fwrite($fp, $contens);
151  fclose($fp);
152  }
153 
154 
155  public function sendInvoice($subject, $message, $to = null, $bytes, $fname = "faktura")
156  {
157 
158  $content = chunk_split(base64_encode($bytes));
159 
160  if (!isset($to)) $to = $this->email;
161  $filename = $fname . ".pdf";
162 
163  $uid = md5(uniqid(time()));
164 
165  $header = "From: " . ilERPDebtor::senderName . " <". ilERPDebtor::senderEmail.">\r\n";
166  $header .= "Reply-To: " . ilERPDebtor::senderEmail . "\r\n";
167  $header .= "MIME-Version: 1.0\r\n";
168  $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
169  $header .= "This is a multi-part message in MIME format.\r\n";
170  $header .= "--".$uid."\r\n";
171  $header .= "Content-type:text/plain; charset=utf-8\r\n";
172  $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
173  $header .= $message."\r\n\r\n";
174  $header .= "--".$uid."\r\n";
175  $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
176  $header .= "Content-Transfer-Encoding: base64\r\n";
177  $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
178  $header .= $content."\r\n\r\n";
179  $header .= "--".$uid."--";
180 
181  /*
182  include_once './Services/Mail/classes/class.ilMimeMail.php';
183  $mail = new ilMimeMail;
184  $mail->autoCheck(true);
185  $mail->Subject($subject);
186  $mail->From(ilERPDebtor::senderName . " <". ilERPDebtor::senderEmail.">");
187  $mail->ReplyTo(ilERPDebtor::senderEmail);
188  $mail->To($to);
189  $mail->Body("Mail body");
190  $mail->Attach(
191 
192  $mail->Send();*/
193 
194  $restore_me = ini_get('display_errors');
195  ini_set('display_errors', 0);
196  mail($to, $subject, "", $header);
197  ini_set('display_errors', $restore_me);
198 
199  }
200 
204  public function setTestValues()
205  {
206  $fname = array("Jesper", "Nicolai", "Alex", "Stefan", "Helmut", "Elvis");
207  $lname = array("Gødvad", "Lundgaard", "Killing", "Meyer", "Schottmüller", "Presly");
208  $city = array("Copenhagen", "Århus", "Collonge", "Bremen", "SecretPlace" );
209  $country = array("Denmark", "Germany", "France", "Ümlaudia", "Graceland");
210  $road = array(" Straße", " Road", "vej", " Boulevard");
211 
212  $this->number = rand(1000,1010);
213  $this->name = $fname[rand(0,5)] . " " . $lname[rand(0,5)];
214  $this->email = "noreply@ilias.dk";
215  $this->address= "Ilias" . $road[rand(0,3)] ." " . rand(1,100);
216  $this->postalcode = rand(2000,7000);
217  $this->city = $city[rand(0,3)];
218  $this->country = $country[rand(0,4)];
219  $this->phone = "+" . rand(1,45) . " " . rand(100,999) . " " . rand(1000, 9999);
220  $this->ean = 0;
221  $this->website = ilERPDebtor::website;
222  }
223 
224 }
225 
226 
227 ?>