ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPurchaseBMFGUI.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 */
32 include_once './payment/classes/class.ilPaymentShoppingCart.php';
33 include_once './payment/classes/class.ilPaymentShoppingCartGUI.php';
34 include_once './payment/classes/class.ilPaymentCoupons.php';
35 include_once './payment/classes/class.ilBMFSettings.php';
36 #include_once dirname(__FILE__)."/../bmf/lib/ePayment/cfg_epayment.inc.php";
37 include_once dirname(__FILE__)."/../bmf/lib/SOAP/class.ilBMFClient.php";
38 
40 {
41  var $ctrl;
42  var $tpl;
43 
44  var $user_obj;
45  var $coupon_obj = null;
46  var $error;
48 
50 
52  {
53  global $ilias, $ilDB, $lng, $tpl, $rbacsystem, $ilCtrl, $ilTabs;
54  $this->ilias = $ilias;
55  $this->db = $ilDB;
56  $this->lng = $lng;
57  $this->ctrl = $ilCtrl;
58  $this->tpl = $tpl;
59 
60  // Get user object
61  $this->user_obj = $user_obj;
62 
63  $this->coupon_obj = new ilPaymentCoupons($this->user_obj);
64 
65  if (!is_array($_SESSION["bmf"]["personal_data"]))
66  {
67  $_SESSION["bmf"]["personal_data"]["vorname"] = $this->user_obj->getFirstname();
68  $_SESSION["bmf"]["personal_data"]["nachname"] = $this->user_obj->getLastname();
69  if (strpos("_" . $this->user_obj->getStreet(), " ") > 0)
70  {
71  $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(), " ")+1);
72  $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
73  $_SESSION["bmf"]["personal_data"]["strasse"] = $street;
74  $_SESSION["bmf"]["personal_data"]["hausNr"] = $houseNo;
75  }
76  else
77  {
78  $_SESSION["bmf"]["personal_data"]["strasse"] = $this->user_obj->getStreet();
79  $_SESSION["bmf"]["personal_data"]["hausNr"] = "";
80  }
81  $_SESSION["bmf"]["personal_data"]["postfach"] = "";
82  $_SESSION["bmf"]["personal_data"]["PLZ"] = $this->user_obj->getZipcode();
83  $_SESSION["bmf"]["personal_data"]["ort"] = $this->user_obj->getCity();
84  $_SESSION["bmf"]["personal_data"]["land"] = $this->__getCountryCode($this->user_obj->getCountry());
85  $_SESSION["bmf"]["personal_data"]["EMailAdresse"] = $this->user_obj->getEmail();
86  $_SESSION["bmf"]["personal_data"]["sprache"] = $this->user_obj->getLanguage();
87  }
88 
89  if (!is_array($_SESSION["coupons"]["bmf"]))
90  {
91  $_SESSION["coupons"]["bmf"] = array();
92  }
93 
94  $this->__loadTemplate();
95 
96  $this->error = "";
97 
98  $this->lng->loadLanguageModule("payment");
99 
100  $ilTabs->clearTargets();
101  $ilTabs->clearSubTabs();
102  }
103 
104  function cancel()
105  {
106  ilUtil::redirect("./payment.php");
107  }
108 
109  function showPersonalData()
110  {
111  // user_id $this->user_obj->getId()
112  // all
113 
114  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
115 
116  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
117  {
118 
119  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
120  $this->tpl->touchBlock("stop_floating");
121  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
122 
123  }
124  else
125  {
126 
127  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_personal_data.html','payment');
128  #$this->tpl = new ilTemplate('tpl.pay_bmf_personal_data.html', true, true, 'payment');
129 
130  $this->tpl->setVariable("PERSONAL_DATA_FORMACTION",$this->ctrl->getFormAction($this));
131 
132  // set table header
133  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
134  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
135  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step1'));
136  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_personal_data'));
137  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_personal_data'));
138  $this->tpl->touchBlock("stop_floating");
139  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
140 
141  // set plain text variables
142  $this->tpl->setVariable("TXT_FIRSTNAME",$this->lng->txt('firstname'));
143  $this->tpl->setVariable("TXT_LASTNAME",$this->lng->txt('lastname'));
144  $this->tpl->setVariable("TXT_STREET",$this->lng->txt('street'));
145  $this->tpl->setVariable("TXT_HOUSE_NUMBER",$this->lng->txt('pay_bmf_house_number'));
146  $this->tpl->setVariable("TXT_OR",$this->lng->txt('pay_bmf_or'));
147  $this->tpl->setVariable("TXT_PO_BOX",$this->lng->txt('pay_bmf_po_box'));
148  $this->tpl->setVariable("TXT_ZIPCODE",$this->lng->txt('zipcode'));
149  $this->tpl->setVariable("TXT_CITY",$this->lng->txt('city'));
150  $this->tpl->setVariable("TXT_COUNTRY",$this->lng->txt('country'));
151  $this->tpl->setVariable("TXT_EMAIL",$this->lng->txt('email'));
152 
153  $this->tpl->setVariable("INPUT_VALUE",ucfirst($this->lng->txt('next')));
154  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
155 
156  // fill defaults
157 
158  $this->error != "" && isset($_POST['country']) ? $this->__showCountries($this->tpl, $_POST['country']) : $this->__showCountries($this->tpl, $_SESSION['bmf']['personal_data']['land']);
159 /* $this->tpl->setVariable("FIRSTNAME",
160  $this->error != "" && isset($_POST['firstname'])
161  ? ilUtil::prepareFormOutput($_POST['firstname'],true)
162  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['vorname'],true));
163  $this->tpl->setVariable("LASTNAME",
164  $this->error != "" && isset($_POST['lastname'])
165  ? ilUtil::prepareFormOutput($_POST['lastname'],true)
166  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['nachname'],true));*/
167  $this->tpl->setVariable("FIRSTNAME", $this->user_obj->getFirstname());
168  $this->tpl->setVariable("LASTNAME", $this->user_obj->getLastname());
169  $this->tpl->setVariable("STREET",
170  $this->error != "" && isset($_POST['street'])
171  ? ilUtil::prepareFormOutput($_POST['street'],true)
172  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['strasse'],true));
173  $this->tpl->setVariable("HOUSE_NUMBER",
174  $this->error != "" && isset($_POST['house_number'])
175  ? ilUtil::prepareFormOutput($_POST['house_number'],true)
176  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['hausNr'],true));
177  $this->tpl->setVariable("PO_BOX",
178  $this->error != "" && isset($_POST['po_box'])
179  ? ilUtil::prepareFormOutput($_POST['po_box'],true)
180  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['postfach'],true));
181  $this->tpl->setVariable("ZIPCODE",
182  $this->error != "" && isset($_POST['zipcode'])
183  ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
184  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['PLZ'],true));
185  $this->tpl->setVariable("CITY",
186  $this->error != "" && isset($_POST['city'])
187  ? ilUtil::prepareFormOutput($_POST['city'],true)
188  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['ort'],true));
189 /* $this->tpl->setVariable("EMAIL",
190  $this->error != "" && isset($_POST['email'])
191  ? ilUtil::prepareFormOutput($_POST['email'],true)
192  : ilUtil::prepareFormOutput($_SESSION['bmf']["personal_data"]['EMailAdresse'],true));*/
193  $this->tpl->setVariable("EMAIL", $this->user_obj->getEmail());
194 
195  }
196  }
197 
198  function getPersonalData()
199  {
200 /* if ($_POST"firstname"] == "" ||
201  $_POST["lastname"] == "" ||*/
202  if ($_SESSION["bmf"]["personal_data"]["vorname"] == "" ||
203  $_SESSION["bmf"]["personal_data"]["nachname"] == "" ||
204  $_POST["zipcode"] == "" ||
205  $_POST["city"] == "" ||
206  $_POST["country"] == "" ||
207 /* $_POST["email"] == "")*/
208  $_SESSION["bmf"]["personal_data"]["EMailAdresse"] == "")
209  {
210  $this->error = $this->lng->txt('pay_bmf_personal_data_not_valid');
211  ilUtil::sendInfo($this->error);
212  $this->showPersonalData();
213  return;
214  }
215  if (($_POST["street"] == "" && $_POST["house_number"] == "" && $_POST["po_box"] == "") ||
216  (($_POST["street"] != "" || $_POST["house_number"] != "") && $_POST["po_box"] != "") ||
217  ($_POST["street"] != "" && $_POST["house_number"] == "") ||
218  ($_POST["street"] == "" && $_POST["house_number"] != ""))
219  {
220  $this->error = $this->lng->txt('pay_bmf_street_or_pobox');
221  ilUtil::sendInfo($this->error);
222  $this->showPersonalData();
223  return;
224  }
225 
226 /* $_SESSION["bmf"]["personal_data"]["vorname"] = $_POST["firstname"];
227  $_SESSION["bmf"]["personal_data"]["nachname"] = $_POST["lastname"];*/
228  $_SESSION["bmf"]["personal_data"]["vorname"] = $this->user_obj->getFirstname();
229  $_SESSION["bmf"]["personal_data"]["nachname"] = $this->user_obj->getLastname();
230  $_SESSION["bmf"]["personal_data"]["strasse"] = $_POST["street"];
231  $_SESSION["bmf"]["personal_data"]["hausNr"] = $_POST["house_number"];
232  $_SESSION["bmf"]["personal_data"]["postfach"] = $_POST["po_box"];
233  $_SESSION["bmf"]["personal_data"]["PLZ"] = $_POST["zipcode"];
234  $_SESSION["bmf"]["personal_data"]["ort"] = $_POST["city"];
235  $_SESSION["bmf"]["personal_data"]["land"] = $_POST["country"];
236 /* $_SESSION["bmf"]["personal_data"]["EMailAdresse"] = $_POST["email"];*/
237  $_SESSION["bmf"]["personal_data"]["EmailAdresse"] = $this->user_obj->getEmail();
238  $_SESSION["bmf"]["personal_data"]["sprache"] = $this->user_obj->getLanguage();
239 
240  if ($_SESSION["bmf"]["personal_data"]["land"] != "DE")
241  {
242  if ($_SESSION["bmf"]["payment_type"] == "debit_entry")
243  {
244  $_SESSION["bmf"]["payment_type"] = "";
245  }
246  }
247 
248  $this->error = "";
249  $this->showPaymentType();
250  }
251 
252  function showPaymentType()
253  {
254  // user_id $this->user_obj->getId()
255  // all
256 
257  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
258 
259  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
260  {
261 
262  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
263  $this->tpl->touchBlock("stop_floating");
264  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
265 
266  }
267  else
268  {
269 
270  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_payment_type.html','payment');
271  #$this->tpl = new ilTemplate('tpl.pay_bmf_payment_type.html', true, true, 'payment');
272 
273  $this->tpl->setVariable("PAYMENT_TYPE_FORMACTION",$this->ctrl->getFormAction($this));
274 
275  // set table header
276  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
277  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
278  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step2'));
279  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_payment_type'));
280  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_payment_type'));
281  $this->tpl->touchBlock("stop_floating");
282  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
283 
284  // set plain text variables
285  if ($_SESSION["bmf"]["personal_data"]["land"] == "DE")
286  {
287  $this->tpl->setVariable("TXT_DEBIT_ENTRY",$this->lng->txt('pay_bmf_debit_entry'));
288  }
289  $this->tpl->setVariable("TXT_CREDIT_CARD",$this->lng->txt('pay_bmf_credit_card'));
290 
291  $this->tpl->setVariable("INPUT_VALUE",ucfirst($this->lng->txt('next')));
292  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
293 
294  // fill defaults
295 
296  if ($this->error != "" &&
297  isset($_POST["payment_type"]))
298  {
299  $this->tpl->setVariable("PAYMENT_TYPE_" . strtoupper($_POST["payment_type"]), " checked") ;
300  }
301  else
302  {
303  if (($_SESSION["bmf"]["personal_data"]["land"] != "DE" && $_POST["payment_type"] != "debit_entry") ||
304  $_SESSION["bmf"]["personal_data"]["land"] == "DE")
305  {
306  $this->tpl->setVariable("PAYMENT_TYPE_" . strtoupper($_SESSION["bmf"]["payment_type"]), " checked") ;
307  }
308  }
309 
310  // Button
311  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
312  $this->tpl->setCurrentBlock("btn_cell");
313  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPersonalData"));
314  $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
315  $this->tpl->parseCurrentBlock("btn_cell");
316 
317  }
318  }
319 
320  function getPaymentType()
321  {
322  if (($_POST["payment_type"] != "credit_card" && $_POST["payment_type"] != "debit_entry") ||
323  ($_SESSION["bmf"]["personal_data"]["land"] != "DE" && $_POST["payment_type"] == "debit_entry"))
324  {
325  $this->error = $this->lng->txt('pay_bmf_payment_type_not_valid');
326  ilUtil::sendInfo($this->error);
327  $this->showPaymentType();
328  return;
329  }
330 
331  $_SESSION["bmf"]["payment_type"] = $_POST["payment_type"];
332 
333  $this->error = "";
334  if ($_SESSION["bmf"]["payment_type"] == "credit_card")
335  {
336  $this->showCreditCard();
337  }
338  else
339  {
340  $this->showDebitEntry();
341  }
342  }
343 
344  function showDebitEntry()
345  {
346  // user_id $this->user_obj->getId()
347  // all
348 
349 /* if ($_SESSION["bmf"]["debit_entry"]["kontoinhaber"] == "" &&
350  $this->error == "" &&
351  $_POST["account_holder"] == "")
352  {
353  $_SESSION["bmf"]["debit_entry"]["kontoinhaber"] = $_SESSION["bmf"]["personal_data"]["vorname"] . " " . $_SESSION["bmf"]["personal_data"]["nachname"];
354  }*/
355 
356  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
357 
358  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
359  {
360 
361  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
362  $this->tpl->touchBlock("stop_floating");
363  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
364 
365  }
366  else
367  {
368 
369  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_debit_entry.html','payment');
370  #$this->tpl = new ilTemplate('tpl.pay_bmf_debit_entry.html', true, true, 'payment');
371 
372  $this->__showShoppingCart();
373 
374  $this->tpl->setVariable("DEBIT_ENTRY_FORMACTION",$this->ctrl->getFormAction($this));
375 
376  // set table header
377  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
378  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
379  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step3_debit_entry'));
380  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_debit_entry_data'));
381  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_debit_entry'));
382  $this->tpl->touchBlock("stop_floating");
383  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
384 
385  // set plain text variables
386  $this->tpl->setVariable("TXT_ACCOUNT_HOLDER",$this->lng->txt('pay_bmf_account_holder'));
387  $this->tpl->setVariable("TXT_OPTIONAL",$this->lng->txt('pay_bmf_optional'));
388  $this->tpl->setVariable("TXT_BANK_CODE",$this->lng->txt('pay_bmf_bank_code'));
389  $this->tpl->setVariable("TXT_ACCOUNT_NUMBER",$this->lng->txt('pay_bmf_account_number'));
390  $this->tpl->setVariable("TXT_TERMS_CONDITIONS",$this->lng->txt('pay_bmf_terms_conditions'));
391  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_READ",$this->lng->txt('pay_bmf_terms_conditions_read'));
392  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt('pay_bmf_terms_conditions_show'));
393  $this->tpl->setVariable("LINK_TERMS_CONDITIONS","./payment.php?view=conditions");
394  $this->tpl->setVariable("TXT_PASSWORD",$this->lng->txt('password'));
395  $this->tpl->setVariable("TXT_CONFIRM_ORDER",$this->lng->txt('pay_confirm_order'));
396 
397  $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_send_order'));
398  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
399 
400  // fill defaults
401 
402  $this->tpl->setVariable("ACCOUNT_HOLDER",
403  $this->error != "" && isset($_POST['account_holder'])
404  ? ilUtil::prepareFormOutput($_POST['account_holder'],true)
405  : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['kontoinhaber'],true));
406  $this->tpl->setVariable("BANK_CODE",
407  $this->error != "" && isset($_POST['bank_code'])
408  ? ilUtil::prepareFormOutput($_POST['bank_code'],true)
409  : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['BLZ'],true));
410  $this->tpl->setVariable("ACCOUNT_NUMBER",
411  $this->error != "" && isset($_POST['account_number'])
412  ? ilUtil::prepareFormOutput($_POST['account_number'],true)
413  : ilUtil::prepareFormOutput($_SESSION['bmf']["debit_entry"]['kontoNr'],true));
414 /* if ($this->error != "" &&
415  isset($_POST["terms_conditions"]))
416  {
417  $this->tpl->setVariable("TERMS_CONDITIONS_" . strtoupper($_POST["terms_conditions"]), " checked") ;
418  }*/
419 /* if ($this->error != "" &&
420  isset($_POST["password"]))
421  {
422  $this->tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST['password'],true));
423  }*/
424 
425  // Button
426  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
427  $this->tpl->setCurrentBlock("btn_cell");
428  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPaymentType"));
429  $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
430  $this->tpl->parseCurrentBlock("btn_cell");
431 
432  }
433  }
434 
435  function getDebitEntry()
436  {
437  if ($_POST["account_holder"] == "" ||
438  $_POST["bank_code"] == "" ||
439  $_POST["account_number"] == "")
440  {
441  $this->error = $this->lng->txt('pay_bmf_debit_entry_not_valid');
442  ilUtil::sendInfo($this->error);
443  $this->showDebitEntry();
444  return;
445  }
446  if ($_POST["terms_conditions"] != 1)
447  {
448  $this->error = $this->lng->txt('pay_bmf_check_terms_conditions');
449  ilUtil::sendInfo($this->error);
450  $this->showDebitEntry();
451  return;
452  }
453  if ($_POST["password"] == "" ||
454  md5($_POST["password"]) != $this->user_obj->getPasswd())
455  {
456  $this->error = $this->lng->txt('pay_bmf_password_not_valid');
457  ilUtil::sendInfo($this->error);
458  $this->showDebitEntry();
459  return;
460  }
461 
462  $_SESSION["bmf"]["debit_entry"]["BLZ"] = $_POST["bank_code"];
463  $_SESSION["bmf"]["debit_entry"]["kontoinhaber"] = $_POST["account_holder"];
464  $_SESSION["bmf"]["debit_entry"]["kontoNr"] = $_POST["account_number"];
465 
466  $this->error = "";
467  $this->sendDebitEntry();
468  }
469 
470  function sendDebitEntry()
471  {
472  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
473 
474  $this->psc_obj->clearCouponItemsSession();
475 
476  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
477  {
478 
479  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
480  $this->tpl->touchBlock("stop_floating");
481  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
482 
483  }
484  else
485  {
486  $customer = new KundenstammdatenPflegeWS();
487 
488  $newCustomer = new Kunde($this->user_obj->getId());
489 
490  $resultCustomerObj = $customer->anlegenKunde($newCustomer);
491 
492  $resultCustomer = $resultCustomerObj->ergebnis;
493 
494  if (is_object($resultCustomer))
495  {
496  if ($resultCustomer->code < 0)
497  {
498  $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $resultCustomer->code . ": " . $resultCustomer->kurzText . "<br>\n" . $resultCustomer->langText;
499  if ($resultCustomer->code == -103 ||
500  $resultCustomer->code == -104 ||
501  $resultCustomer->code == -107 ||
502  ($resultCustomer->code <= -202 && $resultCustomer->code >= -208) ||
503  $resultCustomer->code == -213)
504  {
506  $this->showPersonalData();
507  }
508  else
509  {
510  $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
512  $this->showPersonalData();
513  }
514  }
515  else
516  {
517  $payment = new LastschriftWS();
518 
519  $debitEntry = new Lastschrift();
520 
521  $address = new LieferAdresse();
522 
523  $bank = new Bankverbindung();
524 
525  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
526 
527  $tmp_bookEntries = $sc_obj->getShoppingCart();
528  if (!is_array($tmp_bookEntries))
529  {
530  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
531  }
532  else
533  {
534  $totalAmount = 0;
535  for ($i = 0; $i < count($tmp_bookEntries); $i++)
536  {
537  $booking = true;
538 
539  if (!empty($_SESSION["coupons"]["bmf"]))
540  {
541  $price = $tmp_bookEntries[$i]["betrag"];
542  $tmp_bookEntries[$i]["math_price"] = (float) $price;
543 
544  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
545  {
546  $this->coupon_obj->setId($coupon["pc_pk"]);
547  $this->coupon_obj->setCurrentCoupon($coupon);
548 
549  $tmp_pobject =& new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i]['pobject_id']);
550 
551  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
552  {
553  $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += (float) $price;
554  $_SESSION["coupons"]["bmf"][$key]["items"][] = $tmp_bookEntries[$i];
555  $booking = false;
556  }
557 
558  unset($tmp_pobject);
559  }
560  }
561 
562  if ($booking)
563  {
564  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
565 
566  $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
567  $totalAmount += $tmp_bookEntries[$i]["betrag"];
568  }
569  else
570  {
571  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
572  }
573  }
574 
575  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
576 
577  if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
578  {
579  foreach ($coupon_discount_items as $item)
580  {
581  $item["betrag"] = $item["discount_price"];
582  $bookEntries[] = new Buchung($item);
583  $totalAmount += $item["betrag"];
584  }
585  }
586 
587  $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
588  $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
589  }
590 
591  # vd($address);
592  # vd($debitEntry);
593  # vd($bank);
594  # vd($bookingList);
595 
596  $resultObj = $payment->abbuchenOhneEinzugsermaechtigung($resultCustomerObj->kunde->EShopKundenNr, $address, $bank, $bookingList);
597  $result = $resultObj->ergebnis;
598 
599  if (is_object($result))
600  {
601  if ($result->code < 0)
602  {
603  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
604  $this->tpl->touchBlock("stop_floating");
605  $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
606  if ($result->code == -103 ||
607  $result->code == -104 ||
608  $result->code == -107 ||
609  ($result->code <= -202 && $result->code >= -208) ||
610  $result->code == -213)
611  {
613  $this->showPersonalData();
614  }
615  else if ($result->code == -507 ||
616  $result->code == -510 ||
617  $result->code == -511)
618  {
620  $this->showPaymentType();
621  }
622  else if ($result->code == -402 ||
623  $result->code == -402 ||
624  $result->code == -403 ||
625  $result->code == -406 ||
626  $result->code == -410 ||
627  $result->code == -413 ||
628  $result->code == -701 ||
629  $result->code == -702 ||
630  $result->code == -703)
631  {
633  $this->showDebitEntry();
634  }
635  else
636  {
637  $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
639  $this->showPersonalData();
640  }
641 
642  }
643  else
644  {
645  $resultCustomerObj->kunde->vorname = utf8_decode($resultCustomerObj->kunde->vorname);
646  $resultCustomerObj->kunde->nachname = utf8_decode($resultCustomerObj->kunde->nachname);
647  $resultCustomerObj->kunde->rechnungsAdresse->strasse = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse);
648  $resultCustomerObj->kunde->rechnungsAdresse->hausNr = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
649  $resultCustomerObj->kunde->rechnungsAdresse->postfach = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
650  $resultCustomerObj->kunde->rechnungsAdresse->PLZ = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
651  $resultCustomerObj->kunde->rechnungsAdresse->ort = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
652  $resultCustomerObj->kunde->rechnungsAdresse->land = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
653 
654  // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
655  $this->__sendBill($resultCustomerObj->kunde, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
656 
657  $this->__addBookings($resultObj,$bookingList->getTransaction());
658  $this->__emptyShoppingCart();
659  $this->__clearSession();
660 
661  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
662  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
663  $this->tpl->touchBlock("stop_floating");
664 
665  ilUtil::sendInfo($this->lng->txt('pay_bmf_thanks'));
666 
667  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_debit_entry.html','payment');
668  #$this->tpl = new ilTemplate('tpl.pay_bmf_debit_entry.html', true, true, 'payment');
669  if ($this->ilias->getSetting("https") != 1)
670  {
671  $this->tpl->setCurrentBlock("buyed_objects");
672  #$this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", "./payment.php?baseClass=ilpaymentbuyedobjectsgui&cmd=2");
673  #$link = $this->ctrl->getLinkTargetByClass('ilpaymentbuyedobjectsgui', 'showItems');
674  $link = $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui');
675  $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", $link);
676  $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
677  $this->tpl->parseCurrentBlock("buyed_objects");
678  }
679  $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
680  }
681  }
682  else
683  {
684  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
685  $this->tpl->touchBlock("stop_floating");
686  ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
687  }
688  }
689  }
690  else
691  {
692  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
693  $this->tpl->touchBlock("stop_floating");
694  ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
695  }
696  }
697  }
698 
699  function showCreditCard()
700  {
701  // user_id $this->user_obj->getId()
702  // all
703 
704 /* if ($_SESSION["bmf"]["credit_card"]["karteninhaber"] == "" &&
705  $this->error == "" &&
706  $_POST["card_holder"] == "")
707  {
708  $_SESSION["bmf"]["credit_card"]["karteninhaber"] = $_SESSION["bmf"]["personal_data"]["vorname"] . " " . $_SESSION["bmf"]["personal_data"]["nachname"];
709  }*/
710 
711  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
712 
713  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
714  {
715 
716  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
717  $this->tpl->touchBlock("stop_floating");
718  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
719 
720  }
721  else
722  {
723 
724  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html','payment');
725  #$this->tpl = new ilTemplate('tpl.pay_bmf_credit_card.html', true, true, 'payment');
726  $this->__showShoppingCart();
727 
728  $this->tpl->setVariable("CREDIT_CARD_FORMACTION",$this->ctrl->getFormAction($this));
729 
730  // set table header
731  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_pays_b.gif'));
732  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
733  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_step3_credit_card'));
734  $this->tpl->setVariable("TITLE",$this->lng->txt('pay_bmf_credit_card_data'));
735  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_description_credit_card'));
736  $this->tpl->touchBlock("stop_floating");
737  $this->tpl->setVariable("TXT_CLOSE_WINDOW",$this->lng->txt('close_window'));
738 
739  // set plain text variables
740  $this->tpl->setVariable("TXT_CARD_HOLDER",$this->lng->txt('pay_bmf_card_holder'));
741  $this->tpl->setVariable("TXT_CHECK_NUMBER",$this->lng->txt('pay_bmf_check_number'));
742  $this->tpl->setVariable("TXT_OPTIONAL",$this->lng->txt('pay_bmf_optional'));
743  $this->tpl->setVariable("TXT_CARD_NUMBER",$this->lng->txt('pay_bmf_card_number'));
744  $this->tpl->setVariable("TXT_VALIDITY",$this->lng->txt('pay_bmf_validity'));
745  $this->tpl->setVariable("TXT_TERMS_CONDITIONS",$this->lng->txt('pay_bmf_terms_conditions'));
746  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_READ",$this->lng->txt('pay_bmf_terms_conditions_read'));
747  $this->tpl->setVariable("TXT_TERMS_CONDITIONS_SHOW",$this->lng->txt('pay_bmf_terms_conditions_show'));
748  $this->tpl->setVariable("LINK_TERMS_CONDITIONS","./payment.php?view=conditions");
749  $this->tpl->setVariable("TXT_PASSWORD",$this->lng->txt('password'));
750  $this->tpl->setVariable("TXT_CONFIRM_ORDER",$this->lng->txt('pay_confirm_order'));
751 
752  $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_send_order'));
753  $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
754 
755  // fill defaults
756 
757  $this->tpl->setVariable("CARD_HOLDER",
758  $this->error != "" && isset($_POST['card_holder'])
759  ? ilUtil::prepareFormOutput($_POST['card_holder'],true)
760  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['karteninhaber'],true));
761  $this->tpl->setVariable("CARD_NUMBER_BLOCK_1",
762  $this->error != "" && isset($_POST['card_number']['block_1'])
763  ? ilUtil::prepareFormOutput($_POST['card_number']['block_1'],true)
764  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_1'],true));
765  $this->tpl->setVariable("CARD_NUMBER_BLOCK_2",
766  $this->error != "" && isset($_POST['card_number']['block_2'])
767  ? ilUtil::prepareFormOutput($_POST['card_number']['block_2'],true)
768  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_2'],true));
769  $this->tpl->setVariable("CARD_NUMBER_BLOCK_3",
770  $this->error != "" && isset($_POST['card_number']['block_3'])
771  ? ilUtil::prepareFormOutput($_POST['card_number']['block_3'],true)
772  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_3'],true));
773  $this->tpl->setVariable("CARD_NUMBER_BLOCK_4",
774  $this->error != "" && isset($_POST['card_number']['block_4'])
775  ? ilUtil::prepareFormOutput($_POST['card_number']['block_4'],true)
776  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kreditkartenNr']['block_4'],true));
777  $this->tpl->setVariable("CHECK_NUMBER",
778  $this->error != "" && isset($_POST['check_number'])
779  ? ilUtil::prepareFormOutput($_POST['check_number'],true)
780  : ilUtil::prepareFormOutput($_SESSION['bmf']["credit_card"]['kartenpruefnummer'],true));
781  for ($i = 1; $i <= 12; $i++)
782  {
783  $this->tpl->setCurrentBlock("loop_validity_months");
784  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS", $i < 10 ? "0" . $i : $i);
785  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_TXT", $i < 10 ? "0" . $i : $i);
786  if ($this->error != "" &&
787  isset($_POST['validity']['month']))
788  {
789  if ($_POST['validity']['month'] == $i)
790  {
791  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
792  }
793  }
794  else
795  {
796  if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] == $i)
797  {
798  $this->tpl->setVariable("LOOP_VALIDITY_MONTHS_SELECTED", " selected");
799  }
800  }
801  $this->tpl->parseCurrentBlock("loop_validity_months");
802  }
803  for ($i = date("Y"); $i <= (date("Y")+6); $i++)
804  {
805  $this->tpl->setCurrentBlock("loop_validity_years");
806  $this->tpl->setVariable("LOOP_VALIDITY_YEARS", $i);
807  $this->tpl->setVariable("LOOP_VALIDITY_YEARS_TXT", $i);
808  if ($this->error != "" &&
809  isset($_POST['validity']['year']))
810  {
811  if ($_POST['validity']['year'] == $i)
812  {
813  $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
814  }
815  }
816  else
817  {
818  if ($_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] == $i)
819  {
820  $this->tpl->setVariable("LOOP_VALIDITY_YEARS_SELECTED", " selected");
821  }
822  }
823  $this->tpl->parseCurrentBlock("loop_validity_years");
824  }
825 /* if ($this->error != "" &&
826  isset($_POST["terms_conditions"]))
827  {
828  $this->tpl->setVariable("TERMS_CONDITIONS_" . $_POST["terms_conditions"], " checked") ;
829  }*/
830 /* if ($this->error != "" &&
831  isset($_POST["password"]))
832  {
833  $this->tpl->setVariable("PASSWORD", ilUtil::prepareFormOutput($_POST['password'],true));
834  }*/
835 
836  // Button
837  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
838  $this->tpl->setCurrentBlock("btn_cell");
839  $this->tpl->setVariable("BTN_LINK", $this->ctrl->getLinkTarget($this, "showPaymentType"));
840  $this->tpl->setVariable("BTN_TXT", $this->lng->txt('pay_bmf_back'));
841  $this->tpl->parseCurrentBlock("btn_cell");
842 
843  }
844  }
845 
846  function getCreditCard()
847  {
848  if ($_POST["card_holder"] == "" ||
849  $_POST["card_number"]["block_1"] == "" ||
850  $_POST["card_number"]["block_2"] == "" ||
851  $_POST["card_number"]["block_3"] == "" ||
852  $_POST["card_number"]["block_4"] == "" ||
853  $_POST["validity"]["month"] == "" ||
854  $_POST["validity"]["year"] == "" ||
855  $_POST["validity"]["year"]."-".$_POST["validity"]["month"] < date("Y-m"))
856  {
857  $this->error = $this->lng->txt('pay_bmf_credit_card_not_valid');
858  ilUtil::sendInfo($this->error);
859  $this->showCreditCard();
860  return;
861  }
862  if ($_POST["terms_conditions"] != 1)
863  {
864  $this->error = $this->lng->txt('pay_bmf_check_terms_conditions');
865  ilUtil::sendInfo($this->error);
866  $this->showCreditCard();
867  return;
868  }
869  if ($_POST["password"] == "" ||
870  md5($_POST["password"]) != $this->user_obj->getPasswd())
871  {
872  $this->error = $this->lng->txt('pay_bmf_password_not_valid');
873  ilUtil::sendInfo($this->error);
874  $this->showCreditCard();
875  return;
876  }
877 
878  $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["monat"] = $_POST["validity"]["month"];
879  $_SESSION["bmf"]["credit_card"]["gueltigkeit"]["jahr"] = $_POST["validity"]["year"];
880  $_SESSION["bmf"]["credit_card"]["karteninhaber"] = $_POST["card_holder"];
881  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_1"] = $_POST["card_number"]["block_1"];
882  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_2"] = $_POST["card_number"]["block_2"];
883  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_3"] = $_POST["card_number"]["block_3"];
884  $_SESSION["bmf"]["credit_card"]["kreditkartenNr"]["block_4"] = $_POST["card_number"]["block_4"];
885  $_SESSION["bmf"]["credit_card"]["kartenpruefnummer"] = $_POST["check_number"];
886 
887  $this->error = "";
888  $this->sendCreditCard();
889  }
890 
891  function sendCreditCard()
892  {
893  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
894 
895  $this->psc_obj->clearCouponItemsSession();
896 
897  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
898  {
899 
900  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
901  $this->tpl->touchBlock("stop_floating");
902  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
903 
904  }
905  else
906  {
907 
908  $payment = new KreditkartenzahlungWS();
909 
910  $customer = new Kunde($this->user_obj->getId());
911 
912  $creditCard = new Kreditkarte();
913 
914  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
915 
916  $tmp_bookEntries = $sc_obj->getShoppingCart();
917  if (!is_array($tmp_bookEntries))
918  {
919  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
920  }
921  else
922  {
923  $totalAmount = 0;
924  for ($i = 0; $i < count($tmp_bookEntries); $i++)
925  {
926  $booking = true;
927 
928  if (!empty($_SESSION["coupons"]["bmf"]))
929  {
930  $price = $tmp_bookEntries[$i]["betrag"];
931  $tmp_bookEntries[$i]["math_price"] = (float) $price;
932 
933  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
934  {
935  $this->coupon_obj->setId($coupon["pc_pk"]);
936  $this->coupon_obj->setCurrentCoupon($coupon);
937 
938  $tmp_pobject =& new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i]['pobject_id']);
939 
940  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
941  {
942  $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += (float) $price;
943  $_SESSION["coupons"]["bmf"][$key]["items"][] = $tmp_bookEntries[$i];
944 
945  $booking = false;
946  }
947 
948  unset($tmp_pobject);
949  }
950  }
951 
952  if ($booking)
953  {
954  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
955 
956  $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
957  $totalAmount += $tmp_bookEntries[$i]["betrag"];
958  }
959  else
960  {
961  $tmp_bookEntries[$i]["betrag_string"] = number_format( (float) $tmp_bookEntries[$i]["betrag"] , 2, ",", ".");
962  }
963  }
964 
965  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
966 
967  if (is_array($coupon_discount_items) && !empty($coupon_discount_items))
968  {
969  foreach ($coupon_discount_items as $item)
970  {
971  $item["betrag"] = $item["discount_price"];
972  $bookEntries[] = new Buchung($item);
973  $totalAmount += $item["discount_price"];
974  }
975  }
976 
977  $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
978  $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
979  }
980 
981 # vd($customer);
982 # vd($creditCard);
983 # vd($bookingList);
984 
985  $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
986  $result = $resultObj->ergebnis;
987 
988 # vd($result);
989 
990  if (is_object($result))
991  {
992  if ($result->code < 0)
993  {
994  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
995  $this->tpl->touchBlock("stop_floating");
996  $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
997  if ($result->code == -103 ||
998  $result->code == -104 ||
999  $result->code == -107 ||
1000  ($result->code <= -202 && $result->code >= -208) ||
1001  $result->code == -213)
1002  {
1004  $this->showPersonalData();
1005  }
1006  else if ($result->code == -507 ||
1007  $result->code == -510 ||
1008  $result->code == -511)
1009  {
1011  $this->showPaymentType();
1012  }
1013  else if ($result->code == -701 ||
1014  $result->code == -1701 ||
1015  $result->code == -1706 ||
1016  $result->code == -1707 ||
1017  $result->code == -1710 ||
1018  $result->code == -1711)
1019  {
1021  $this->showCreditCard();
1022  }
1023  else
1024  {
1025  $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
1027  $this->showPersonalData();
1028  }
1029 
1030  }
1031  else
1032  {
1033  // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
1034  $this->__sendBill($customer, $_SESSION["bmf"]["payment_type"], $bookingList, $resultObj);
1035 
1036  $this->__addBookings($resultObj,$bookingList->getTransaction());
1037  $this->__emptyShoppingCart();
1038  $this->__clearSession();
1039 
1040  $this->tpl->setVariable("HEADER",$this->lng->txt('pay_bmf_your_order'));
1041  $this->tpl->setVariable("DESCRIPTION",$this->lng->txt('pay_bmf_thanks'));
1042  $this->tpl->touchBlock("stop_floating");
1043 
1044  ilUtil::sendInfo($this->lng->txt('pay_bmf_thanks'));
1045 
1046  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_bmf_credit_card.html','payment');
1047  #$this->tpl = new ilTemplate('tpl.pay_bmf_credit_card.html', true, true, 'payment');
1048  if ($this->ilias->getSetting("https") != 1)
1049  {
1050  $this->tpl->setCurrentBlock("buyed_objects");
1051  #$this->ctrl->redirectByClass("ilPaymentBuyedObjectsGUI", "ilpaymentbuyedobjectsgui");
1052  #$link = $this->ctrl->getLinkTargetByClass('ilpaymentbuyedobjectsgui', 'showItems');
1053  $link = $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui');
1054  $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", $link);
1055  $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
1056  $this->tpl->parseCurrentBlock("buyed_objects");
1057  }
1058  $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
1059  }
1060  }
1061  else
1062  {
1063  $this->tpl->setVariable("HEADER",$this->lng->txt('error'));
1064  $this->tpl->touchBlock("stop_floating");
1065  ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
1066  }
1067 
1068  }
1069 
1070  }
1071 
1075  function &executeCommand()
1076  {
1077  global $tree;
1078 
1079  $cmd = $this->ctrl->getCmd();
1080 
1081  switch ($this->ctrl->getNextClass($this))
1082  {
1083 
1084  default:
1085  if(!$cmd = $this->ctrl->getCmd())
1086  {
1087  $cmd = 'showPersonalData';
1088  }
1089  $this->$cmd();
1090  break;
1091  }
1092  }
1093 
1094  // PRIVATE
1095  function __sendBill($customer, $paymentType, $bookingList, $result)
1096  {
1097  include_once './classes/class.ilTemplate.php';
1098  include_once "./Services/Utilities/classes/class.ilUtil.php";
1099  include_once './payment/classes/class.ilGeneralSettings.php';
1100  include_once './payment/classes/class.ilPaymentShoppingCart.php';
1101  include_once 'Services/Mail/classes/class.ilMimeMail.php';
1102 
1103  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1104  $genSet = new ilGeneralSettings();
1105 
1106  $tpl = new ilTemplate("./payment/templates/default/tpl.pay_bmf_bill.html", true, true, true);
1107 
1108  $tpl->setVariable("VENDOR_ADDRESS", nl2br(utf8_decode($genSet->get("address"))));
1109  $tpl->setVariable("VENDOR_ADD_INFO", nl2br(utf8_decode($genSet->get("add_info"))));
1110  $tpl->setVariable("VENDOR_BANK_DATA", nl2br(utf8_decode($genSet->get("bank_data"))));
1111  $tpl->setVariable("TXT_BANK_DATA", utf8_decode($this->lng->txt("pay_bank_data")));
1112 
1113  $tpl->setVariable("CUSTOMER_FIRSTNAME", $customer->vorname);
1114  $tpl->setVariable("CUSTOMER_LASTNAME", $customer->nachname);
1115  if ($customer->rechnungsAdresse->strasse != "" &&
1116  $customer->rechnungsAdresse->hausNr != "")
1117  {
1118  $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->strasse . " ". $customer->rechnungsAdresse->hausNr);
1119  }
1120  else
1121  {
1122  $tpl->setVariable("CUSTOMER_STREET_POBOX", $customer->rechnungsAdresse->postfach);
1123  }
1124  $tpl->setVariable("CUSTOMER_ZIPCODE", $customer->rechnungsAdresse->PLZ);
1125  $tpl->setVariable("CUSTOMER_CITY", $customer->rechnungsAdresse->ort);
1126  $tpl->setVariable("CUSTOMER_COUNTRY", $this->__getCountryName($customer->rechnungsAdresse->land));
1127 
1128  $tpl->setVariable("BILL_NO", $result->buchungsListe->kassenzeichen);
1129  $tpl->setVariable("DATE", date("d.m.Y"));
1130 
1131  $tpl->setVariable("TXT_BILL", utf8_decode($this->lng->txt("pays_bill")));
1132  $tpl->setVariable("TXT_BILL_NO", utf8_decode($this->lng->txt("pay_bill_no")));
1133  $tpl->setVariable("TXT_DATE", utf8_decode($this->lng->txt("date")));
1134 
1135  $tpl->setVariable("TXT_ARTICLE", utf8_decode($this->lng->txt("pay_article")));
1136  $tpl->setVariable("TXT_PRICE", utf8_decode($this->lng->txt("price_a")));
1137 
1138  $bookEntries = $sc_obj->getShoppingCart();
1139  for ($i = 0; $i < count($bookEntries); $i++)
1140  {
1141  $tmp_pobject =& new ilPaymentObject($this->user_obj, $bookEntries[$i]['pobject_id']);
1142 
1143  $assigned_coupons = '';
1144  if (!empty($_SESSION["coupons"]["bmf"]))
1145  {
1146  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
1147  {
1148  $this->coupon_obj->setId($coupon["pc_pk"]);
1149  $this->coupon_obj->setCurrentCoupon($coupon);
1150 
1151  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1152  {
1153  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon["pcc_code"];
1154  }
1155  }
1156  }
1157 
1158  $tpl->setCurrentBlock("loop");
1159  $tpl->setVariable("LOOP_OBJ_TYPE", utf8_decode($this->lng->txt($bookEntries[$i]["typ"])));
1160  $tpl->setVariable("LOOP_TITLE", $bookEntries[$i]["buchungstext"]. $assigned_coupons);
1161  $tpl->setVariable("LOOP_TXT_ENTITLED_RETRIEVE", utf8_decode($this->lng->txt("pay_entitled_retrieve")));
1162  $tpl->setVariable("LOOP_DURATION", $bookEntries[$i]["dauer"] . " " . utf8_decode($this->lng->txt("paya_months")));
1163  $tpl->setVariable("LOOP_PRICE", number_format($bookEntries[$i]["betrag"], 2, ",", ".") . " " . $genSet->get("currency_unit"));
1164  $tpl->parseCurrentBlock("loop");
1165 
1166  unset($tmp_pobject);
1167  }
1168 
1169  if (!empty($_SESSION["coupons"]["bmf"]))
1170  {
1171  if (count($items = $bookEntries))
1172  {
1173  $sub_total_amount = $bookingList->betrag;
1174 
1175  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1176  {
1177  $this->coupon_obj->setId($coupon["pc_pk"]);
1178  $this->coupon_obj->setCurrentCoupon($coupon);
1179 
1180  $total_object_price = 0.0;
1181  $current_coupon_bonus = 0.0;
1182 
1183  foreach ($bookEntries as $item)
1184  {
1185  $tmp_pobject =& new ilPaymentObject($this->user_obj, $item['pobject_id']);
1186 
1187  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1188  {
1189  $total_object_price += $item["betrag"];
1190  }
1191 
1192  unset($tmp_pobject);
1193  }
1194 
1195  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1196 
1197  $sub_total_amount += $current_coupon_bonus;
1198 
1199  $tpl->setCurrentBlock("cloop");
1200  $tpl->setVariable("TXT_COUPON", utf8_decode($this->lng->txt("paya_coupons_coupon") . " " . $coupon["pcc_code"]));
1201  $tpl->setVariable("BONUS", number_format($current_coupon_bonus * (-1), 2, ',', '.') . " " . $genSet->get("currency_unit"));
1202  $tpl->parseCurrentBlock();
1203  }
1204 
1205  $tpl->setVariable("TXT_SUBTOTAL_AMOUNT", utf8_decode($this->lng->txt("pay_bmf_subtotal_amount")));
1206  $tpl->setVariable("SUBTOTAL_AMOUNT", number_format($sub_total_amount, 2, ",", ".") . " " . $genSet->get("currency_unit"));
1207  }
1208  }
1209 
1210  if ($bookingList->betrag < 0) $bookingList->betrag = 0.0;
1211 
1212  $tpl->setVariable("TXT_TOTAL_AMOUNT", utf8_decode($this->lng->txt("pay_bmf_total_amount")));
1213  $tpl->setVariable("TOTAL_AMOUNT", number_format($bookingList->betrag, 2, ",", ".") . " " . $genSet->get("currency_unit"));
1214  if (($vat = $sc_obj->getVat($bookingList->betrag)) > 0)
1215  {
1216  $tpl->setVariable("VAT", number_format($vat, 2, ",", ".") . " " . $genSet->get("currency_unit"));
1217  $tpl->setVariable("TXT_VAT", $genSet->get("vat_rate") . "% " . utf8_decode($this->lng->txt("pay_bmf_vat_included")));
1218  }
1219 
1220  if ($paymentType == "debit_entry")
1221  {
1222  $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_debit_entry")));
1223  }
1224  else
1225  {
1226  $tpl->setVariable("TXT_PAYMENT_TYPE", utf8_decode($this->lng->txt("pay_payed_credit_card")));
1227  }
1228 
1229  if (!@file_exists($genSet->get("pdf_path")))
1230  {
1231  ilUtil::makeDir($genSet->get("pdf_path"));
1232  }
1233 
1234  if (@file_exists($genSet->get("pdf_path")))
1235  {
1236  ilUtil::html2pdf($tpl->get(), $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
1237  }
1238 
1239  if (@file_exists($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf") &&
1240  $customer->EMailAdresse != "" &&
1241  $this->ilias->getSetting("admin_email") != "")
1242  {
1243  $m= new ilMimeMail; // create the mail
1244  $m->From( $this->ilias->getSetting("admin_email") );
1245  $m->To( $customer->EMailAdresse );
1246  $m->Subject( $this->lng->txt("pay_message_subject") );
1247  $message = $this->lng->txt("pay_message_hello") . " " . utf8_encode($customer->vorname) . " " . utf8_encode($customer->nachname) . ",\n\n";
1248  $message .= $this->lng->txt("pay_message_thanks") . "\n\n";
1249  $message .= $this->lng->txt("pay_message_attachment") . "\n\n";
1250  $message .= $this->lng->txt("pay_message_regards") . "\n\n";
1251  $message .= strip_tags($genSet->get("address"));
1252  $m->Body( $message ); // set the body
1253  $m->Attach( $genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf", "application/pdf" ) ; // attach a file of type image/gif
1254  $m->Send(); // send the mail
1255  }
1256 
1257  @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".html");
1258  @unlink($genSet->get("pdf_path") . "/" . $result->buchungsListe->kassenzeichen . ".pdf");
1259 
1260  }
1261 
1262  function __addBookings($a_result,$a_transaction)
1263  {
1264  include_once './payment/classes/class.ilPaymentBookings.php';
1265  include_once './payment/classes/class.ilPaymentShoppingCart.php';
1266  include_once './payment/classes/class.ilPaymentObject.php';
1267  include_once './payment/classes/class.ilPaymentPrices.php';
1268 
1269  $booking_obj =& new ilPaymentBookings();
1270 
1271  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1272 
1273  $items = $sc_obj->getEntries(PAY_METHOD_BMF);
1274 
1275  $sc_obj->clearCouponItemsSession();
1276 
1277  foreach($items as $entry)
1278  {
1279  $pobject =& new ilPaymentObject($this->user_obj,$entry['pobject_id']);
1280 
1281  $price = ilPaymentPrices::_getPrice($entry['price_id']);
1282 
1283  if (!empty($_SESSION["coupons"]["bmf"]))
1284  {
1285  $entry["math_price"] = (float) ilPaymentPrices::_getPriceFromArray($price);
1286  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
1287  {
1288  $this->coupon_obj->setId($coupon["pc_pk"]);
1289  $this->coupon_obj->setCurrentCoupon($coupon);
1290 
1291  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
1292  {
1293  $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += (float) ilPaymentPrices::_getPriceFromArray($price);
1294  $_SESSION["coupons"]["bmf"][$key]["items"][] = $entry;
1295  }
1296  }
1297  }
1298 
1299  unset($pobject);
1300  }
1301 
1302  $coupon_discount_items = $sc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
1303 
1304  $i = 0;
1305  foreach($items as $entry)
1306  {
1307  $pobject =& new ilPaymentObject($this->user_obj,$entry['pobject_id']);
1308 
1309  $price = ilPaymentPrices::_getPrice($entry['price_id']);
1310 
1311  if (array_key_exists($entry["pobject_id"], $coupon_discount_items))
1312  {
1313  $bonus = $coupon_discount_items[$entry["pobject_id"]]["math_price"] - $coupon_discount_items[$entry["pobject_id"]]["discount_price"];
1314  }
1315 
1316  $booking_obj->setTransaction($a_transaction);
1317  $booking_obj->setPobjectId($entry['pobject_id']);
1318  $booking_obj->setCustomerId($this->user_obj->getId());
1319  $booking_obj->setVendorId($pobject->getVendorId());
1320  $booking_obj->setPayMethod($pobject->getPayMethod());
1321  $booking_obj->setOrderDate(time());
1322  $booking_obj->setDuration($price['duration']);
1323  $booking_obj->setPrice(ilPaymentPrices::_getPriceString($entry['price_id']));
1324  $booking_obj->setDiscount($bonus > 0 ? ilPaymentPrices::_getPriceStringFromAmount((-1) * $bonus) : "");
1325  $booking_obj->setPayed(1);
1326  $booking_obj->setAccess(1);
1327  $booking_obj->setVoucher($a_result->buchungsListe->buchungen[$i++]->belegNr);
1328  $booking_obj->setTransactionExtern($a_result->buchungsListe->kassenzeichen);
1329 
1330  $current_booking_id = $booking_obj->add();
1331 
1332  if (!empty($_SESSION["coupons"]["bmf"]) && $current_booking_id)
1333  {
1334  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1335  {
1336  $this->coupon_obj->setId($coupon["pc_pk"]);
1337  $this->coupon_obj->setCurrentCoupon($coupon);
1338 
1339  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
1340  {
1341  $this->coupon_obj->addCouponForBookingId($current_booking_id);
1342  }
1343  }
1344  }
1345 
1346  unset($current_booking_id);
1347  unset($pobject);
1348  }
1349 
1350  if (!empty($_SESSION["coupons"]["bmf"]))
1351  {
1352  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1353  {
1354  $this->coupon_obj->setId($coupon["pc_pk"]);
1355  $this->coupon_obj->setCurrentCoupon($coupon);
1356  $this->coupon_obj->addTracking();
1357  }
1358  }
1359  }
1360 
1362  {
1363  include_once './payment/classes/class.ilPaymentShoppingCart.php';
1364 
1365  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1366 
1367  return $sc_obj->emptyShoppingCart();
1368  }
1369 
1370  function __clearSession()
1371  {
1372  $_SESSION["coupons"]["bmf"] = "";
1373  $_SESSION["bmf"]["payment_type"] = "";
1374  $_SESSION["bmf"]["debit_entry"] = array();
1375  $_SESSION["bmf"]["credit_card"] = array();
1376  }
1377 
1378  function __loadTemplate()
1379  {
1380  $this->tpl->addBlockFile("CONTENT", "content", "tpl.payb_content.html");
1381 
1382  $this->__buildStylesheet();
1383  $this->__buildStatusline();
1384  }
1385 
1387  {
1388  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1389 # $this->__buildLocator();
1390  }
1391 
1392  function __buildLocator()
1393  {
1394  $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
1395  $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
1396 
1397  $this->tpl->setCurrentBlock("locator_item");
1398  $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
1399  $this->tpl->setVariable("LINK_ITEM","../ilias.php?baseClass=ilPersonalDesktopGUI");
1400  #$this->tpl->setVariable("LINK_ITEM", "../usr_personaldesktop.php");
1401  $this->tpl->parseCurrentBlock();
1402 
1403  $this->tpl->setCurrentBlock("locator_item");
1404  $this->tpl->setVariable("PREFIX",'>&nbsp;');
1405 # $this->tpl->setVariable("ITEM", $this->lng->txt("pay_locator"));
1406  $this->tpl->setVariable("ITEM", "Payment");
1407  $this->tpl->setVariable("LINK_ITEM", "./payment.php");
1408  $this->tpl->parseCurrentBlock();
1409 
1410  // CHECK for new mail and info
1411  ilUtil::sendInfo();
1412 
1413  return true;
1414  }
1415 
1417  {
1418  $this->tpl->setVariable("LOCATION_STYLESHEET",ilUtil::getStyleSheetLocation());
1419  }
1420 
1424  function __showCountries(&$tpl, $value = "")
1425  {
1426  $countries = $this->__getCountries();
1427  foreach($countries as $code => $text)
1428  {
1429  $tpl->setCurrentBlock("loop_countries");
1430  $tpl->setVariable("LOOP_COUNTRIES", $code);
1431  $tpl->setVariable("LOOP_COUNTRIES_TXT", $text);
1432  if ($value != "" &&
1433  $value == $code)
1434  {
1435  $tpl->setVariable("LOOP_COUNTRIES_SELECTED", " selected");
1436  }
1437  $tpl->parseCurrentBlock("loop_countries");
1438  }
1439  $tpl->setVariable("TXT_PLEASE_SELECT", $this->lng->txt("pay_bmf_please_select"));
1440  return;
1441  }
1442 
1443  function __getCountries()
1444  {
1445  global $lng;
1446 
1447  $lng->loadLanguageModule("meta");
1448 
1449  $cntcodes = array ("DE","ES","FR","GB","AT","CH","AF","AL","DZ","AS","AD","AO",
1450  "AI","AQ","AG","AR","AM","AW","AU","AT","AZ","BS","BH","BD","BB","BY",
1451  "BE","BZ","BJ","BM","BT","BO","BA","BW","BV","BR","IO","BN","BG","BF",
1452  "BI","KH","CM","CA","CV","KY","CF","TD","CL","CN","CX","CC","CO","KM",
1453  "CG","CK","CR","CI","HR","CU","CY","CZ","DK","DJ","DM","DO","TP","EC",
1454  "EG","SV","GQ","ER","EE","ET","FK","FO","FJ","FI","FR","FX","GF","PF",
1455  "TF","GA","GM","GE","DE","GH","GI","GR","GL","GD","GP","GU","GT","GN",
1456  "GW","GY","HT","HM","HN","HU","IS","IN","ID","IR","IQ","IE","IL","IT",
1457  "JM","JP","JO","KZ","KE","KI","KP","KR","KW","KG","LA","LV","LB","LS",
1458  "LR","LY","LI","LT","LU","MO","MK","MG","MW","MY","MV","ML","MT","MH",
1459  "MQ","MR","MU","YT","MX","FM","MD","MC","MN","MS","MA","MZ","MM","NA",
1460  "NR","NP","NL","AN","NC","NZ","NI","NE","NG","NU","NF","MP","NO","OM",
1461  "PK","PW","PA","PG","PY","PE","PH","PN","PL","PT","PR","QA","RE","RO",
1462  "RU","RW","KN","LC","VC","WS","SM","ST","SA","CH","SN","SC","SL","SG",
1463  "SK","SI","SB","SO","ZA","GS","ES","LK","SH","PM","SD","SR","SJ","SZ",
1464  "SE","SY","TW","TJ","TZ","TH","TG","TK","TO","TT","TN","TR","TM","TC",
1465  "TV","UG","UA","AE","GB","UY","US","UM","UZ","VU","VA","VE","VN","VG",
1466  "VI","WF","EH","YE","ZR","ZM","ZW");
1467  $cntrs = array();
1468  foreach($cntcodes as $cntcode)
1469  {
1470  $cntrs[$cntcode] = $lng->txt("meta_c_".$cntcode);
1471  }
1472  asort($cntrs);
1473  return $cntrs;
1474  }
1475 
1476  function __getCountryCode($value = "")
1477  {
1478  $countries = $this->__getCountries();
1479  foreach($countries as $code => $text)
1480  {
1481  if ($text == $value)
1482  {
1483  return $code;
1484  }
1485  }
1486  return;
1487  }
1488 
1489  function __getCountryName($value = "")
1490  {
1491  $countries = $this->__getCountries();
1492  return $countries[$value];
1493  }
1494 
1495 /* function __getShoppingCart()
1496  {
1497  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
1498 
1499  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
1500  {
1501  return 0;
1502  }
1503 
1504  $counter = 0;
1505  foreach($items as $item)
1506  {
1507  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
1508 
1509  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());
1510 
1511  $f_result[$counter]["buchungstext"] = $tmp_obj->getTitle();
1512 
1513  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
1514 
1515  $price = (int) $price_arr['unit_value'];
1516 
1517  if ($price_arr['sub_unit_value'] != "" &&
1518  $price_arr['sub_unit_value'] > 0)
1519  {
1520  $price .= '.'.( (int) $price_arr['sub_unit_value']);
1521  }
1522  $f_result[$counter]["betrag"] = $price * 1.0;
1523 
1524  unset($tmp_obj);
1525  unset($tmp_pobject);
1526 
1527  ++$counter;
1528  }
1529  return $f_result;
1530  }
1531 
1532  function __getTotalAmount()
1533  {
1534  $amount = 0;
1535 
1536  if (is_array($result = $this->__getShoppingCart()))
1537  {
1538  for ($i = 0; $i < count($result); $i++)
1539  {
1540  $amount += $result[$i]["betrag"];
1541  }
1542  }
1543 
1544  return $amount;
1545  }*/
1546 
1548  {
1549 
1550  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
1551 
1552  if(!count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
1553  {
1554  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
1555  }
1556 
1557  $counter = 0;
1558  foreach($items as $item)
1559  {
1560  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
1561 
1562  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());
1563 
1564  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
1565 
1566  $assigned_coupons = '';
1567  if (!empty($_SESSION["coupons"]["bmf"]))
1568  {
1569  foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon)
1570  {
1571  $this->coupon_obj->setId($coupon["pc_pk"]);
1572  $this->coupon_obj->setCurrentCoupon($coupon);
1573 
1574  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1575  {
1576  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon["pcc_code"];
1577  }
1578  }
1579  }
1580 
1581  $f_result[$counter][] = $tmp_obj->getTitle();
1582  if ($assigned_coupons != '') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
1583 
1584  $f_result[$counter][] = $price_arr['duration'] . " " . $this->lng->txt("paya_months");
1585 
1586  $f_result[$counter][] = ilPaymentPrices::_getPriceString($item['price_id']);
1587 
1588  unset($tmp_obj);
1589  unset($tmp_pobject);
1590 
1591  ++$counter;
1592  }
1593 
1594  return $this->__showItemsTable($f_result);
1595  }
1596 
1597  function &__initTableGUI()
1598  {
1599  include_once "./Services/Table/classes/class.ilTableGUI.php";
1600 
1601  return new ilTableGUI(0,false);
1602  }
1603 
1604  function __showItemsTable($a_result_set)
1605  {
1606  include_once './payment/classes/class.ilGeneralSettings.php';
1607 
1608  $genSet = new ilGeneralSettings();
1609 
1610  $tbl =& $this->__initTableGUI();
1611  $tpl =& $tbl->getTemplateObject();
1612 
1613  // SET FORMAACTION
1614  $tpl->setCurrentBlock("tbl_form_header");
1615 
1616  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1617  $tpl->parseCurrentBlock();
1618 
1619  $tbl->setTitle($this->lng->txt("paya_shopping_cart"),"icon_pays_b.gif",$this->lng->txt("paya_shopping_cart"));
1620  $tbl->setHeaderNames(array($this->lng->txt("title"),
1621  $this->lng->txt("duration"),
1622  $this->lng->txt("price_a")));
1623 
1624  $tbl->setHeaderVars(array("title",
1625  "duration",
1626  "price"),
1627  array("cmd" => "",
1628  "cmdClass" => "ilpurchasebmfgui",
1629  "cmdNode" => $_GET["cmdNode"]));
1630 
1631  $tbl->disable("footer");
1632  $tbl->disable("sort");
1633  $tbl->disable("linkbar");
1634 
1635  $offset = $_GET["offset"];
1636  $order = $_GET["sort_by"];
1637  $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
1638 
1639  $tbl->setOrderColumn($order,'title');
1640  $tbl->setOrderDirection($direction);
1641  $tbl->setOffset($offset);
1642  $tbl->setLimit($_GET["limit"]);
1643  $tbl->setMaxCount(count($a_result_set));
1644 # $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1645  $tbl->setData($a_result_set);
1646 
1647  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
1648 
1649  $totalAmount = $sc_obj->getTotalAmount();
1650  $vat = $sc_obj->getVat($totalAmount[PAY_METHOD_BMF]);
1651 
1652  $tpl->setCurrentBlock("tbl_footer_linkbar");
1653  $amount .= "<table class=\"\" style=\"float: right;\">\n";
1654  if (!empty($_SESSION["coupons"]["bmf"]))
1655  {
1656  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
1657 
1658  if (count($items = $this->psc_obj->getEntries(PAY_METHOD_BMF)))
1659  {
1660  $amount .= "<tr>\n";
1661  $amount .= "<td>\n";
1662  $amount .= "<b>" . $this->lng->txt("pay_bmf_subtotal_amount") . ":";
1663  $amount .= "</td>\n";
1664  $amount .= "<td>\n";
1665  $amount .= number_format($totalAmount[PAY_METHOD_BMF], 2, ',', '.') . " " . $genSet->get("currency_unit") . "</b>";
1666  $amount .= "</td>\n";
1667  $amount .= "</tr>\n";
1668 
1669  foreach ($_SESSION["coupons"]["bmf"] as $coupon)
1670  {
1671  $this->coupon_obj->setCurrentCoupon($coupon);
1672  $this->coupon_obj->setId($coupon["pc_pk"]);
1673 
1674  $total_object_price = 0.0;
1675  $current_coupon_bonus = 0.0;
1676 
1677  foreach ($items as $item)
1678  {
1679  $tmp_pobject =& new ilPaymentObject($this->user_obj, $item['pobject_id']);
1680 
1681  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1682  {
1683  $price_data = ilPaymentPrices::_getPrice($item['price_id']);
1684  $price = ((int) $price_data["unit_value"]) . "." . sprintf("%02d", ((int) $price_data["sub_unit_value"]));
1685 
1686  $total_object_price += $price;
1687  }
1688 
1689  unset($tmp_pobject);
1690  }
1691 
1692  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1693  $totalAmount[PAY_METHOD_BMF] += $current_coupon_bonus * (-1);
1694 
1695  $amount .= "<tr>\n";
1696  $amount .= "<td>\n";
1697  $amount .= $this->lng->txt("paya_coupons_coupon") . " " . $coupon["pcc_code"] . ":";
1698  $amount .= "</td>\n";
1699  $amount .= "<td>\n";
1700  $amount .= number_format($current_coupon_bonus * (-1), 2, ',', '.') . " " . $genSet->get("currency_unit");
1701  $amount .= "</td>\n";
1702  $amount .= "</tr>\n";
1703  }
1704 
1705 
1706  if ($totalAmount[PAY_METHOD_BMF] < 0)
1707  {
1708  $totalAmount[PAY_METHOD_BMF] = 0;
1709  $vat = 0;
1710  }
1711  else
1712  {
1713  $vat = $sc_obj->getVat($totalAmount[PAY_METHOD_BMF]);
1714  }
1715  }
1716  }
1717 
1718  $amount .= "<tr>\n";
1719  $amount .= "<td>\n";
1720  $amount .= "<b>" . $this->lng->txt("pay_bmf_total_amount") . ":";
1721  $amount .= "</td>\n";
1722  $amount .= "<td>\n";
1723  $amount .= number_format($totalAmount[PAY_METHOD_BMF], 2, ',', '.') . " " . $genSet->get("currency_unit");
1724  $amount .= "</td>\n";
1725  $amount .= "</tr>\n";
1726 
1727  if ($vat > 0)
1728  {
1729  $amount .= "<tr>\n";
1730  $amount .= "<td>\n";
1731  $amount .= $genSet->get("vat_rate") . "% " . $this->lng->txt("pay_bmf_vat_included") . ":";
1732  $amount .= "</td>\n";
1733  $amount .= "<td>\n";
1734  $amount .= number_format($vat, 2, ',', '.') . " " . $genSet->get("currency_unit");
1735  $amount .= "</td>\n";
1736  $amount .= "</tr>\n";
1737  }
1738 
1739  $amount .= "</table>\n";
1740 
1741  $tpl->setVariable("LINKBAR", $amount);
1742  $tpl->parseCurrentBlock("tbl_footer_linkbar");
1743  $tpl->setCurrentBlock('tbl_footer');
1744  $tpl->setVariable('COLUMN_COUNT',3);
1745  $tpl->parseCurrentBlock();
1746  $tbl->render();
1747 
1748  $this->tpl->setVariable("ITEMS_TABLE",$tbl->tpl->get());
1749 
1750  return true;
1751  }
1752 
1753 }
1754 
1756 {
1757 
1758  var $_soapClient = NULL;
1759 
1761  {
1762  $bmfSetObj = ilBMFSettings::getInstance();
1763  $bmfConfig = $bmfSetObj->getAll();
1764 
1765  $this->_soapClient = new ilBMFClient($bmfConfig["ePaymentServer"], false, false, array('curl' => array(CURLOPT_SSLCERT => $bmfConfig["clientCertificate"], CURLE_SSL_PEER_CERTIFICATE => $bmfConfig["caCertificate"], CURLOPT_TIMEOUT => (int)$bmfConfig["timeOut"])));
1766  }
1767 
1768  function anlegenKunde ($customer)
1769  {
1770  $bmfSetObj = ilBMFSettings::getInstance();
1771  $bmfConfig = $bmfSetObj->getAll();
1772 
1773  $tmp = array(
1774  'mandantNr' => $bmfConfig["mandantNr"],
1775  'kunde' => $customer
1776  );
1777 
1778  $result = $this->_soapClient->call("anlegenKunde", $tmp, "KundenstammdatenPflegeWS");
1779  return $result;
1780  }
1781 
1782 };
1783 
1785 {
1786  var $_soapClient = NULL;
1787 
1789  {
1790  $bmfSetObj = ilBMFSettings::getInstance();
1791  $bmfConfig = $bmfSetObj->getAll();
1792 
1793  $this->_soapClient = new ilBMFClient($bmfConfig["ePaymentServer"], false, false, array('curl' => array(CURLOPT_SSLCERT => $bmfConfig["clientCertificate"], CURLE_SSL_PEER_CERTIFICATE => $bmfConfig["caCertificate"], CURLOPT_TIMEOUT => (int)$bmfConfig["timeOut"])));
1794  }
1795 
1796  function validierenKreditkarte($creditCard)
1797  {
1798  $bmfSetObj = ilBMFSettings::getInstance();
1799  $bmfConfig = $bmfSetObj->getAll();
1800 
1801  $tmp = array(
1802  'mandantNr' => $bmfConfig["mandantNr"],
1803  'kreditkarte' => $creditCard,
1804  'waehrungskennzeichen' => $bmfConfig["waehrungskennzeichen"]
1805  );
1806 
1807  $result = $this->_soapClient->call("validierenKreditkarte", $tmp, "KreditkartenzahlungWS");
1808  return $result;
1809  }
1810 
1811  function zahlenUndAnlegenKunde($customer, $creditCard, $bookingList)
1812  {
1813  $bmfSetObj = ilBMFSettings::getInstance();
1814  $bmfConfig = $bmfSetObj->getAll();
1815 
1816  $lieferadresse = new LieferAdresse();
1817 
1818  $tmp = array(
1819  'mandantNr' => $bmfConfig["mandantNr"],
1820  'Kunde' => $customer,
1821  'Kreditkarte' => $creditCard,
1822  'buchungsListe' => $bookingList,
1823  'lieferadresse' => $lieferadresse
1824  );
1825 
1826  $result = $this->_soapClient->call("zahlenUndAnlegenKunde", $tmp, "KreditkartenzahlungWS");
1827  return $result;
1828  }
1829 }
1830 
1832 {
1833 
1834  var $_soapClient = NULL;
1835 
1836  function LastschriftWS ()
1837  {
1838  $bmfSetObj = ilBMFSettings::getInstance();
1839  $bmfConfig = $bmfSetObj->getAll();
1840 
1841  $this->_soapClient = new ilBMFClient($bmfConfig["ePaymentServer"], false, false, array('curl' => array(CURLOPT_SSLCERT => $bmfConfig["clientCertificate"], CURLE_SSL_PEER_CERTIFICATE => $bmfConfig["caCertificate"], CURLOPT_TIMEOUT => (int)$bmfConfig["timeOut"])));
1842  }
1843 
1844  function abbuchenOhneEinzugsermaechtigung($eShopCustomerNumber, $address, $bank, $bookingList)
1845  {
1846  $bmfSetObj = ilBMFSettings::getInstance();
1847  $bmfConfig = $bmfSetObj->getAll();
1848 
1849  $tmp = array(
1850  'mandantNr' => $bmfConfig["mandantNr"],
1851  'eShopKundenNr' => $eShopCustomerNumber,
1852  'lieferAdresse' => $address,
1853  'bankverbindung' => $bank,
1854  'buchungsListe' => $bookingList
1855  );
1856 
1857  $result = $this->_soapClient->call("abbuchenOhneEinzugsermaechtigung", $tmp, "LastschriftWS");
1858  return $result;
1859  }
1860 
1861 };
1862 
1863 class Kunde
1864 {
1865  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kunde');
1866 
1867  function Kunde ($customerNumber = "", $values = "")
1868  {
1869 /* if ($customerNumber != "")
1870  {
1871  $this->EShopKundenNr = $customerNumber;
1872  }
1873  else
1874  {*/
1875  $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
1876  if ($customerNumber != "")
1877  {
1878  $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
1879  }
1880 /* }*/
1881 
1882  if ($values == "")
1883  {
1884  $values = $_SESSION["bmf"]["personal_data"];
1885  }
1886 
1887  if ($values["sprache"] != NULL)
1888  {
1889  $this->sprache = $values["sprache"];
1890  }
1891  if ($values["vorname"] != NULL)
1892  {
1893  $this->vorname = utf8_decode($values["vorname"]);
1894  }
1895  if ($values["nachname"] != NULL)
1896  {
1897  $this->nachname = utf8_decode($values["nachname"]);
1898  }
1899  if ($values["EMailAdresse"] != NULL)
1900  {
1901  $this->EMailAdresse = utf8_decode($values["EMailAdresse"]);
1902  }
1903 
1904  $address = new Adresse();
1905 
1906  $this->rechnungsAdresse = $address;
1907  }
1908 
1910  {
1911  return $this->EShopKundenNr;
1912  }
1913 
1914 }
1915 
1916 class Adresse
1917 {
1918  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Adresse');
1919 
1920  function Adresse ($values = "")
1921  {
1922  if ($values == "")
1923  {
1924  $values = $_SESSION["bmf"]["personal_data"];
1925  }
1926 
1927  if (is_array($values))
1928  {
1929  if ($values["strasse"] != NULL)
1930  {
1931  $this->strasse = utf8_decode($values["strasse"]);
1932  }
1933  if ($values["hausNr"] != NULL)
1934  {
1935  $this->hausNr = utf8_decode($values["hausNr"]);
1936  }
1937  if ($values["postfach"] != NULL)
1938  {
1939  $this->postfach = utf8_decode($values["postfach"]);
1940  }
1941  if ($values["land"] != NULL)
1942  {
1943  $this->land = utf8_decode($values["land"]);
1944  }
1945  if ($values["PLZ"] != NULL)
1946  {
1947  $this->PLZ = utf8_decode($values["PLZ"]);
1948  }
1949  if ($values["ort"] != NULL)
1950  {
1951  $this->ort = utf8_decode($values["ort"]);
1952  }
1953  }
1954  }
1955 
1956 }
1957 
1959 {
1960  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Kreditkarte');
1961 
1962  function Kreditkarte ($values = "")
1963  {
1964  if ($values == "")
1965  {
1966  $values = $_SESSION["bmf"]["credit_card"];
1967  }
1968 
1969  if (is_array($values))
1970  {
1971  if ($values["karteninhaber"] != NULL)
1972  {
1973  $this->karteninhaber = utf8_decode($values["karteninhaber"]);
1974  }
1975  if ($values["kartenpruefnummer"] != NULL)
1976  {
1977  $this->kartenpruefnummer = utf8_decode($values["kartenpruefnummer"]);
1978  }
1979  if (is_array ($values["kreditkartenNr"]) &&
1980  count($values["kreditkartenNr"]) == 4)
1981  {
1982  for ($i = 1; $i <= count($values["kreditkartenNr"]); $i++)
1983  {
1984  $this->kreditkartenNr .= utf8_decode($values["kreditkartenNr"]["block_".$i]);# . "-";
1985  }
1986 # $this->kreditkartenNr = substr($this->kreditkartenNr, 0, strlen($this->kreditkartenNr)-1);
1987  }
1988  if (is_array($values["gueltigkeit"]) &&
1989  $values["gueltigkeit"]["monat"] != "" &&
1990  $values["gueltigkeit"]["jahr"] != "")
1991  {
1992  $this->gueltigkeit = utf8_decode($values["gueltigkeit"]["monat"]);
1993  $this->gueltigkeit .= utf8_decode($values["gueltigkeit"]["jahr"]);
1994  }
1995  }
1996  }
1997 
1998 }
1999 
2001 {
2002  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Lastschrift');
2003 
2004  function Lastschrift ($customerNumber = "", $values = "")
2005  {
2006  $this->EShopKundenNr = time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
2007  if ($customerNumber != "")
2008  {
2009  $this->EShopKundenNr = $customerNumber . "_" . time() . "_" . substr(md5(uniqid(rand(), true)), 0, 4);
2010  }
2011  }
2012 
2013 }
2014 
2016 {
2017  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'Bankverbindung');
2018 
2019  function Bankverbindung ($values = "")
2020  {
2021  if ($values == "")
2022  {
2023  $values = $_SESSION["bmf"]["debit_entry"];
2024  }
2025 
2026  if (is_array($values))
2027  {
2028  if ($values["kontoinhaber"] != NULL)
2029  {
2030  $this->kontoinhaber = utf8_decode($values["kontoinhaber"]);
2031  }
2032  if ($values["kontoNr"] != NULL)
2033  {
2034  $this->kontoNr = utf8_decode($values["kontoNr"]);
2035  }
2036  if ($values["BLZ"] != NULL)
2037  {
2038  $this->BLZ = utf8_decode($values["BLZ"]);
2039  }
2040  }
2041  }
2042 
2043 }
2044 
2045 class Buchung
2046 {
2047  var $OBJTypeNS = array ('namespace' => 'http://schemas.xmlsoap.org/soap/encoding/', 'nsPrefix' => 'ns3', 'type' => 'Buchung', 'pnamespace' => 'http://www.bff.bund.de/ePayment', 'pnsPrefix' => 'ns2', 'item' => 'ns2:Buchung');
2048 
2049  function Buchung($values = "")
2050  {
2051  $bmfSetObj = ilBMFSettings::getInstance();
2052  $bmfConfig = $bmfSetObj->getAll();
2053 
2054  if ($bmfConfig["haushaltsstelle"] != NULL)
2055  {
2056  $this->haushaltsstelle = $bmfConfig["haushaltsstelle"];
2057  }
2058  if ($bmfConfig["objektNr"] != NULL)
2059  {
2060  $this->objektnummer = $bmfConfig["objektNr"];
2061  }
2062 
2063  if (is_array($values))
2064  {
2065  if ($values["buchungstext"] != NULL)
2066  {
2067  $buchungstext = utf8_decode($values["buchungstext"]);
2068  if(strlen($buchungstext) > 16)
2069  {
2070  $buchungstext = substr($buchungstext,0,15).'...';
2071  }
2072 
2073  $this->buchungstext = $buchungstext;
2074  }
2075  if ($values["betrag"] != "")
2076  {
2077  $this->betrag = $values["betrag"];
2078  }
2079  }
2080  }
2081 
2082  /* Die BelegNr wird vom BMF zur�ck geliefert */
2083  function setVoucherNumber($voucherNumber)
2084  {
2085  if ($voucherNumber != NULL)
2086  {
2087  $this->belegNr = $voucherNumber;
2088  }
2089  }
2090 
2091  function getVoucherNumber()
2092  {
2093  return $this->belegNr;
2094  }
2095 }
2096 
2098 {
2099  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment', 'nsPrefix' => 'ns2', 'type' => 'BuchungsListe');
2100 
2101  function BuchungsListe($userId, $values = "")
2102  {
2103  global $ilias;
2104 
2105  $bmfSetObj = ilBMFSettings::getInstance();
2106  $bmfConfig = $bmfSetObj->getAll();
2107 
2108  if ($bmfConfig["bewirtschafterNr"] != NULL)
2109  {
2110  $this->bewirtschafterNr = $bmfConfig["bewirtschafterNr"];
2111  }
2112  if ($bmfConfig["waehrungskennzeichen"] != NULL)
2113  {
2114  $this->waehrungskennzeichen = $bmfConfig["waehrungskennzeichen"];
2115  }
2116  $this->faelligkeitsdatum = date("Y-m-d") . "T" . date("H:i:s") . "Z";
2117  if ($bmfConfig["kennzeichenMahnverfahren"] != NULL)
2118  {
2119  $this->kennzeichenMahnverfahren = $bmfConfig["kennzeichenMahnverfahren"];
2120  }
2121 
2122  $inst_id_time = $ilias->getSetting('inst_id').'_'.$userId.'_'.substr((string) time(),-3);
2123  $this->EShopTransaktionsNr = $inst_id_time.substr(md5(uniqid(rand(), true)), 0, 4);
2124 
2125  if (is_array($values))
2126  {
2127  if ($values["betrag"] != NULL)
2128  {
2129  $this->betrag = $values["betrag"];
2130  }
2131  if ($values["buchungen"] != NULL)
2132  {
2133  $this->buchungen = $values["buchungen"];
2134  }
2135  }
2136  }
2137  function getTransaction()
2138  {
2139  return $this->EShopTransaktionsNr;
2140  }
2141 
2142  /* Das Kassenzeichen wird vom BMF zur�ck geliefert */
2143  function setKassenzeichen($kassenzeichen)
2144  {
2145  if ($kassenzeichen != NULL)
2146  {
2147  $this->kassenzeichen = $kassenzeichen;
2148  }
2149  }
2150 
2151  function getKassenzeichen()
2152  {
2153  return $this->kassenzeichen;
2154  }
2155 
2156 }
2157 
2159 {
2160  var $OBJTypeNS = array ('namespace' => 'http://www.bff.bund.de/ePayment' , 'type' => 'LieferAdresse');
2161 
2162  function LieferAdresse ($values = "")
2163  {
2164  if ($values == "")
2165  {
2166  $values = $_SESSION["bmf"]["personal_data"];
2167  }
2168 
2169  if (is_array($values))
2170  {
2171  if ($values["vorname"] != NULL)
2172  {
2173  $this->vorname = utf8_decode($values["vorname"]);
2174  }
2175  if ($values["nachname"] != NULL)
2176  {
2177  $this->nachname = utf8_decode($values["nachname"]);
2178  }
2179  if ($values["strasse"] != NULL)
2180  {
2181  $this->strasse = utf8_decode($values["strasse"]);
2182  }
2183  if ($values["hausNr"] != NULL)
2184  {
2185  $this->hausNr = utf8_decode($values["hausNr"]);
2186  }
2187  if ($values["postfach"] != NULL)
2188  {
2189  $this->postfach = utf8_decode($values["postfach"]);
2190  }
2191  if ($values["land"] != NULL)
2192  {
2193  $this->land = utf8_decode($values["land"]);
2194  }
2195  if ($values["PLZ"] != NULL)
2196  {
2197  $this->PLZ = utf8_decode($values["PLZ"]);
2198  }
2199  if ($values["ort"] != NULL)
2200  {
2201  $this->ort = utf8_decode($values["ort"]);
2202  }
2203  }
2204  }
2205 }
2206 
2207 ?>