ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPurchaseBaseGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
13 include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
14 include_once './Services/Payment/classes/class.ilShopShoppingCartGUI.php';
15 include_once './Services/Payment/classes/class.ilPaymentCoupons.php';
16 include_once './Services/Payment/classes/class.ilShopVatsList.php';
17 include_once './Services/Payment/classes/class.ilPayMethods.php';
18 include_once './Services/Payment/classes/class.ilShopUtils.php';
19 include_once './Services/Payment/classes/class.ilInvoiceNumberPlaceholdersPropertyGUI.php';
20 include_once './Services/Payment/classes/class.ilPaymentObject.php';
21 
23 {
24  public $ctrl;
25  public $tpl;
26 
27  public $psc_obj = null;
28  public $user_obj = null;
29 
30  public $coupon_obj = null;
31  public $error;
32 
33  public $pmethod_obj = null;
34  private $pm_id = 0;
35  private $totalVat = 0;
36  private $session_var = null;
37 
38  private $payed = 1;
39  private $access = 1;
40 
41  public function __construct($user_obj, $pay_method)
42  {
43  global $lng, $tpl, $ilCtrl, $ilTabs;
44 
46 
47  $this->lng = $lng;
48  $this->ctrl = $ilCtrl;
49  $this->tpl = $tpl;
50  $this->user_obj = $user_obj;
51 
52  $this->pmethod_obj = new ilPayMethods($pay_method);
53  $this->session_var = $this->pmethod_obj->getPmTitle();
54 
55  $this->pm_id = $pay_method;
56 
57  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
58 
59  $this->coupon_obj = new ilPaymentCoupons($this->user_obj);
60 
61  if (!is_array($_SESSION[$this->session_var]['personal_data']))
62  {
63  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
64  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
65  if (strpos('_' . $this->user_obj->getStreet(), ' ') > 0)
66  {
67  $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(), ' ')+1);
68  $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
69  $_SESSION[$this->session_var]['personal_data']['street'] = $street;
70  $_SESSION[$this->session_var]['personal_data']['house_number'] = $houseNo;
71  }
72  else
73  {
74  $_SESSION[$this->session_var]['personal_data']['street'] = $this->user_obj->getStreet();
75  $_SESSION[$this->session_var]['personal_data']['house_number'] = '';
76  }
77  $_SESSION[$this->session_var]['personal_data']['po_box'] = '';
78  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $this->user_obj->getZipcode();
79  $_SESSION[$this->session_var]['personal_data']['city'] = $this->user_obj->getCity();
80  $_SESSION[$this->session_var]['personal_data']['country'] = $this->__getCountryCode($this->user_obj->getCountry());
81  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
82  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
83  }
84 
85  if (!is_array($_SESSION['coupons'][$this->session_var]))
86  {
87  $_SESSION['coupons'][$this->session_var] = array();
88  }
89 
90  $this->__loadTemplate();
91  $this->error = '';
92  $this->lng->loadLanguageModule('payment');
93 
94  $ilTabs->clearTargets();
95  $ilTabs->clearSubTabs();
96  }
97 
98  public function cancel()
99  {
100  ilUtil::redirect('./payment.php');
101  }
102 
103  public function showPersonalData()
104  {
105  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
106 
107  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
108  {
109  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
110  $this->tpl->touchBlock('stop_floating');
111  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
112  }
113  else
114  {
115  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
116 
117  $oForm = new ilPropertyFormGUI();
118  $oForm->setFormAction($this->ctrl->getFormAction($this, 'getPersonalData'));
119  $oForm->setTitle($this->lng->txt('pay_bmf_personal_data'));
120 
121  $oFirstname = new ilNonEditableValueGUI($this->lng->txt('firstname'));
122  $oFirstname->setValue($this->user_obj->getFirstname());
123  $oForm->addItem($oFirstname);
124 
125  $oLastname = new ilNonEditableValueGUI($this->lng->txt('lastname'));
126  $oLastname->setValue($this->user_obj->getLastname());
127  $oForm->addItem($oLastname);
128 
129  $oStreet = new ilTextInputGUI($this->lng->txt('street'),'street');
130  $oStreet->setValue($this->error != '' && isset($_POST['street'])
131  ? ilUtil::prepareFormOutput($_POST['street'],true)
132  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['street'],true));
133  $oForm->addItem($oStreet);
134 
135  $oHouseNumber = new ilTextInputGUI($this->lng->txt('pay_bmf_house_number'), 'house_number');
136  $oHouseNumber->setValue($this->error != '' && isset($_POST['house_number'])
137  ? ilUtil::prepareFormOutput($_POST['house_number'],true)
138  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['house_number'],true));
139  $oForm->addItem($oHouseNumber);
140 
141  $oPoBox = new ilTextInputGUI($this->lng->txt('pay_bmf_or').' '.$this->lng->txt('pay_bmf_po_box'), 'po_box');
142  $oPoBox->setValue($this->error != '' && isset($_POST['po_box'])
143  ? ilUtil::prepareFormOutput($_POST['po_box'],true)
144  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['po_box'],true));
145  $oForm->addItem($oPoBox);
146 
147  $oZipCode = new ilTextInputGUI($this->lng->txt('zipcode'), 'zipcode');
148  if($this->user_obj->getZipCode() && !isset($_POST['zipcode']))
149  $oZipCode->setValue($this->user_obj->getZipCode());
150  else
151  $oZipCode->setValue($this->error != '' && isset($_POST['zipcode'])
152  ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
153  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['zipcode'],true));
154  $oForm->addItem($oZipCode);
155 
156  $oCity = new ilTextInputGUI($this->lng->txt('city'), 'city');
157  if($this->user_obj->getCity()&& !isset($_POST['city']))
158  $oCity->setValue($this->user_obj->getCity());
159  else
160  $oCity->setValue($this->error != '' && isset($_POST['city'])
161  ? ilUtil::prepareFormOutput($_POST['city'],true)
162  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['city'],true));
163  $oForm->addItem($oCity);
164 
165  $oCountry = new ilSelectInputGUI($this->lng->txt('country'), 'country');
166  $oCountry->setOptions($this->__getCountries());
167 
168  if($this->user_obj->getSelectedCountry()&& !isset($_POST['country']))
169  $oCountry->setValue($this->user_obj->getSelectedCountry());
170  else
171  $oCountry->setValue($this->error != '' && isset($_POST['country']) ? $_POST['country']
172  : $_SESSION[$this->session_var]['personal_data']['country']);
173  $oForm->addItem($oCountry);
174 
175  $oEmail = new ilNonEditableValueGUI($this->lng->txt('email'));
176  $oEmail->setValue($this->user_obj->getEmail());
177  $oForm->addItem($oEmail);
178 
179  $oForm->addcommandButton('getPersonalData',ucfirst($this->lng->txt('next')));
180 
181  $this->tpl->setVariable('FORM', $oForm->getHTML());
182  }
183  }
184 
185  public function getPersonalData()
186  {
187 
188  if ($_SESSION[$this->session_var]['personal_data']['firstname'] == '' ||
189  $_SESSION[$this->session_var]['personal_data']['lastname'] == '' ||
190  $_POST['zipcode'] == '' ||
191  $_POST['city'] == '' ||
192  $_POST['country'] == '' ||
193  $_SESSION[$this->session_var]['personal_data']['email'] == '')
194  {
195 
196  $this->error = $this->lng->txt('pay_bmf_personal_data_not_valid');
197  ilUtil::sendInfo($this->error);
198  $this->showPersonalData();
199  return;
200  }
201 
202  if (($_POST['street'] == '' && $_POST['house_number'] == '' && $_POST['po_box'] == '') ||
203  (($_POST['street'] != '' || $_POST['house_number'] != '') && $_POST['po_box'] != '') ||
204  ($_POST['street'] != '' && $_POST['house_number'] == '') ||
205  ($_POST['street'] == '' && $_POST['house_number'] != ''))
206  {
207  $this->error = $this->lng->txt('pay_bmf_street_or_pobox');
208  ilUtil::sendInfo($this->error);
209  $this->showPersonalData();
210  return;
211  }
212 
213  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
214  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
215  $_SESSION[$this->session_var]['personal_data']['street'] = $_POST['street'];
216  $_SESSION[$this->session_var]['personal_data']['house_number'] = $_POST['house_number'];
217  $_SESSION[$this->session_var]['personal_data']['po_box'] = $_POST['po_box'];
218  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $_POST['zipcode'];
219  $_SESSION[$this->session_var]['personal_data']['city'] = $_POST['city'];
220  $_SESSION[$this->session_var]['personal_data']['country'] = $_POST['country'];
221 
222  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
223  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
224 
225  $this->error = '';
226  $this->showBillConfirm();
227 
228  }
229 
230  public function showBillConfirm()
231  {
232  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
233 
234  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
235  {
236  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
237  $this->tpl->touchBlock('stop_floating');
238  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
239  }
240  else
241  {
242  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bill_confirm.html','Services/Payment');
243 
244  $this->__showShoppingCart();
245 
246  $this->tpl->setVariable('BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
247 
248  // set table header
249  $this->tpl->setVariable('TYPE_IMG',ilUtil::getImagePath('icon_pays_b.png'));
250  $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_usr'));
251 
252  // set plain text variables
253  $this->tpl->setVariable('TXT_CONFIRM_ORDER',$this->lng->txt('pay_confirm_order'));
254 
255  $this->tpl->setVariable('INPUT_VALUE',$this->lng->txt('pay_send_order'));
256  $this->tpl->setVariable('CANCEL',$this->lng->txt('cancel'));
257 
258  // Button
259  $this->tpl->addBlockfile('BUTTONS', 'buttons', 'tpl.buttons.html');
260  $this->tpl->setCurrentBlock('btn_cell');
261  $this->tpl->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'showPersonalData'));
262  $this->tpl->setVariable('BTN_TXT', $this->lng->txt('pay_bmf_back'));
263  $this->tpl->parseCurrentBlock('btn_cell');
264  }
265  }
266 
270  public function executeCommand()
271  {
272  $cmd = $this->ctrl->getCmd();
273 
274  switch ($this->ctrl->getNextClass($this))
275  {
276  default:
277  if(!$cmd = $this->ctrl->getCmd())
278  {
279  $cmd = 'showPersonalData';
280  }
281  $this->$cmd();
282  break;
283  }
284  }
285 
286  public function __addBookings($external_data = null)
287  {
288  global $ilUser, $ilObjDataCache;
289 
290  $sc = $this->psc_obj->getShoppingCart($this->pm_id);
291 
292 # $this->psc_obj->clearCouponItemsSession();
293 
294  if (is_array($sc) && count($sc) > 0)
295  {
296  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
297  //@todo check $this->usr_obj
298  $book_obj = new ilPaymentBookings($this->usr_obj);
299 
300  for ($i = 0; $i < count($sc); $i++)
301  {
302  if (!empty($_SESSION['coupons'][$this->session_var]))
303  {
304  $sc[$i]['math_price'] = (float) $sc[$i]['price'];
305 
306  $tmp_pobject = new ilPaymentObject($this->user_obj, $sc[$i]['pobject_id']);
307 
308  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
309  {
310  $this->coupon_obj->setId($coupon['pc_pk']);
311  $this->coupon_obj->setCurrentCoupon($coupon);
312 
313  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
314  {
315  $_SESSION['coupons'][$this->session_var][$key]['total_objects_coupon_price'] += (float) $sc[$i]['price'];
316  $_SESSION['coupons'][$this->session_var][$key]['items'][] = $sc[$i];
317  }
318  }
319 
320  unset($tmp_pobject);
321  }
322  }
323 
324  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION['coupons'][$this->session_var]);
326 
327  for ($i = 0; $i < count($sc); $i++)
328  {
329  $pobjectData = ilPaymentObject::_getObjectData($sc[$i]['pobject_id']);
330  $pobject = new ilPaymentObject($this->user_obj,$sc[$i]['pobject_id']);
331 
332  $price = $sc[$i]['price'];
333  $bonus = 0.0;
334 
335  if (array_key_exists($sc[$i]['pobject_id'], $coupon_discount_items))
336  {
337  $bonus = $coupon_discount_items[$sc[$i]['pobject_id']]['math_price'] - $coupon_discount_items[$sc[$i]['pobject_id']]['discount_price'];
338  if($bonus > 0)
339  $discount = round($bonus, 2)* (-1);
340  else $discount = round($bonus, 2);
341 
342  }
343 
344  $book_obj->setTransaction($transaction);
345  $book_obj->setPobjectId($sc[$i]['pobject_id']);
346  $book_obj->setCustomerId($this->user_obj->getId());
347  $book_obj->setVendorId($pobjectData['vendor_id']);
348  $book_obj->setPayMethod($pobjectData['pay_method']);
349  $book_obj->setOrderDate(time());
350 
351  $book_obj->setPrice($sc[$i]['price_string']);
352  //$book_obj->setDiscount($bonus > 0 ? ilPaymentPrices::_getPriceStringFromAmount($bonus * (-1)) : '');
353  $book_obj->setDiscount($discount);
354  $book_obj->setPayed($this->getPayed());
355  $book_obj->setAccess($this->getAccess());
356 
357  $book_obj->setVoucher(''); // bmf
358  $book_obj->setTransactionExtern(''); // bmf , paypal
359 
360  $book_obj->setVatRate($sc[$i]['vat_rate']);
361  $book_obj->setVatUnit($sc[$i]['vat_unit']);
362  $book_obj->setObjectTitle(strip_tags($sc[$i]['object_title']));
363  $book_obj->setAccessExtension($sc[$i]['extension']);
364 
365  switch($sc[$i]["price_type"])
366  {
368  $book_obj->setDuration($sc[$i]['duration']);
369  break;
370 
372  $book_obj->setDuration(0);
373  $book_obj->setAccessStartdate($sc[$i]['duration_from']);
374  $book_obj->setAccessEnddate($sc[$i]['duration_until']);
375  break;
377  $book_obj->setDuration(0);
378  $book_obj->setAccessEnddate(NULL);
379  $book_obj->setUnlimitedDuration($sc[$i]['unlimited_duration']);
380  break;
381  }
382 
383 
384  $book_obj->setPriceType($sc[$i]["price_type"]);
385 //
386  if($external_data)
387  {
388  $book_obj->setVoucher($external_data['voucher']); // bmf
389  $book_obj->setTransactionExtern($external_data['transaction_extern']); // bmf, paypal
390  $book_obj->setStreet($external_data['street'],'');
391  $book_obj->setZipcode($external_data['zipcode']);
392  $book_obj->setCity($external_data['city']);
393  $book_obj->setCountry($external_data['country']);
394  }
395  else
396  if(isset($_SESSION[$this->session_var]['personal_data']))
397  {
398  $book_obj->setStreet($_SESSION[$this->session_var]['personal_data']['street'], $_SESSION[$this->session_var]['personal_data']['house_number']);
399  $book_obj->setPoBox($_SESSION[$this->session_var]['personal_data']['po_box']);
400  $book_obj->setZipcode($_SESSION[$this->session_var]['personal_data']['zipcode']);
401  $book_obj->setCity($_SESSION[$this->session_var]['personal_data']['city']);
402  $book_obj->setCountry($_SESSION[$this->session_var]['personal_data']['country']);
403  }
404  else
405  {
406  $book_obj->setStreet($this->user_obj->getStreet(), '');
407  $book_obj->setPoBox($this->user_obj->getPoBox());
408  $book_obj->setZipcode($this->user_obj->getZipCode());
409  $book_obj->setCity($this->user_obj->getCity());
410  $book_obj->setCountry($this->user_obj->getCountry());
411  }
412 
413  $booking_id = $book_obj->add();
414 
415  // add purchased item to desktop
417 
418  // autosubscribe user if purchased object is a course
419  $obj_type = ilObject::_lookupType((int)$pobject->getRefId(),true);
420 
421  if($obj_type == 'crs')
422  {
424  }
425 
426  if (!empty($_SESSION['coupons'][$this->session_var]) && $booking_id)
427  {
428  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
429  {
430  $this->coupon_obj->setId($coupon['pc_pk']);
431  $this->coupon_obj->setCurrentCoupon($coupon);
432 
433  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
434  {
435  $this->coupon_obj->addCouponForBookingId($booking_id);
436  }
437  }
438  }
439 
440  $obj_id = $ilObjDataCache->lookupObjId($pobjectData['ref_id']);
441  $obj_type = $ilObjDataCache->lookupType($obj_id);
442  $obj_title = $ilObjDataCache->lookupTitle($obj_id);
443 
444  $bookings['list'][] = array(
445  'pobject_id' => $sc[$i]['pobject_id'],
446  'type' => $obj_type,
447  'title' => '['.$obj_id.']: ' . $obj_title,
448  'duration' => $sc[$i]['duration'],
449  'vat_rate' => $sc[$i]['vat_rate'],
450  'vat_unit' => $sc[$i]['vat_unit'],
451  'price_string' => $sc[$i]['price_string'],
452  'price' => $sc[$i]['price'],
453  "price_type" => $sc[$i]["price_type"],
454  "duration_from" => $sc[$i]["duration_from"],
455  "duration_until" => $sc[$i]["duration_until"],
456  "b_pay_method" => $pobjectData["pay_method"],
457  'discount'=> $discount,
458  'access_startdate' => $book_obj->getAccessStartdate(),
459  'access_enddate' => $book_obj->getAccessEnddate()
460  );
461 
462  $total += $sc[$i]['price'];
463  $total_vat += $sc[$i]['vat_unit'];
464  $total_discount += $discount;
465 
466  if ($sc[$i]['psc_id']) $this->psc_obj->delete($sc[$i]['psc_id']);
467  }
468 
469  if (!empty($_SESSION['coupons'][$this->session_var]))
470  {
471  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
472  {
473  $this->coupon_obj->setId($coupon['pc_pk']);
474  $this->coupon_obj->setCurrentCoupon($coupon);
475  $this->coupon_obj->addTracking();
476  }
477  }
478  }
479 
480  $bookings['total'] = $total;
481  $bookings['total_vat'] = $total_vat;
482  $bookings['total_discount'] = $total_discount;
483  $bookings['transaction'] = $transaction;
484  $bookings['street'] = $book_obj->getStreet();
485  $bookings['zipcode'] = $book_obj->getZipCode();
486  $bookings['city'] = $book_obj->getCity();
487  if(2 == strlen($book_obj->getCountry()))
488  {
489  $bookings['country'] = $this->__getCountryName(strtoupper($book_obj->getCountry()));
490  }
491  else
492  {
493  $bookings['country'] = $book_obj->getCountry();
494  }
495  $bookings['transaction_extern'] = $book_obj->getTransactionExtern();
496 
497  $this->user_obj->_toggleActiveStatusOfUsers(array($this->user_obj->getId()), 1);
498  $_SESSION['forceRedirectToShoppingcart'] = 1;
499 
500  $this->__sendBill($bookings);
501  }
502 
503  public function __sendBill($bookings)
504  {
505  global $tpl, $ilSetting;
506 
507  $i = 0;
508 
509  include_once './Services/UICore/classes/class.ilTemplate.php';
510  include_once './Services/Utilities/classes/class.ilUtil.php';
511  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
512  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
513  include_once 'Services/Mail/classes/class.ilMimeMail.php';
514 
515 // $psc_obj = new ilPaymentShoppingCart($this->user_obj);
517  $currency = $genSet->get('currency_unit');
518 
519 // $tpl = new ilTemplate('./Services/Payment/templates/default/tpl.pay_bill.html', true, true, true);
520  $tpl = new ilTemplate('tpl.pay_bill.html', true, true, 'Services/Payment');
521 
522  if($tpl->placeholderExists('HTTP_PATH'))
523  {
524  $http_path = ilUtil::_getHttpPath();
525  $tpl->setVariable('HTTP_PATH', $http_path);
526  }
528  $tpl->setVariable('DATE', utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['order_date'], IL_CAL_UNIX))));
529  $tpl->setVariable('TXT_CREDIT', utf8_decode($this->lng->txt('credit')));
530  $tpl->setVariable('TXT_DAY_OF_SERVICE_PROVISION',$this->lng->txt('day_of_service_provision'));
531  include_once './Services/Payment/classes/class.ilPayMethods.php';
532  $str_paymethod = ilPayMethods::getStringByPaymethod($bookings['list'][$i]['b_pay_method']);
533  if(strlen(trim($bookings['transaction_extern'])))
534  {
535  $tpl->setVariable('TXT_EXTERNAL_BILL_NO', str_replace('%s',$str_paymethod,utf8_decode($this->lng->txt('external_bill_no'))));
536  $tpl->setVariable('EXTERNAL_BILL_NO', $bookings['transaction_extern']);
537  }
538  $tpl->setVariable('TXT_POSITION',$this->lng->txt('position'));
539  $tpl->setVariable('TXT_AMOUNT',$this->lng->txt('amount'));
540  $tpl->setVariable('TXT_UNIT_PRICE', utf8_decode($this->lng->txt('unit_price')));
541 
542  $tpl->setVariable('VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get('address'))));
543  $tpl->setVariable('VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get('add_info'))));
544  $tpl->setVariable('VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get('bank_data'))));
545  $tpl->setVariable('TXT_BANK_DATA', utf8_decode($this->lng->txt('pay_bank_data')));
546 
547 
548  $tpl->setVariable('CUSTOMER_FIRSTNAME', utf8_decode($this->user_obj->getFirstname()));
549  $tpl->setVariable('CUSTOMER_LASTNAME',utf8_decode( $this->user_obj->getLastname()));
550  if($bookings['po_box']== '')
551  {
552  $tpl->setVariable('CUSTOMER_STREET', utf8_decode( $bookings['street'])); // contains also housenumber
553  }
554  else
555  {
556  $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings['po_box']));
557  }
558  $tpl->setVariable('CUSTOMER_ZIPCODE', utf8_decode($bookings['zipcode']));
559  $tpl->setVariable('CUSTOMER_CITY', utf8_decode($bookings['city']));
560  $tpl->setVariable('CUSTOMER_COUNTRY', utf8_decode($bookings['country']));
561 
562  $tpl->setVariable('BILL_NO', $bookings['transaction']);
563  $tpl->setVariable('DATE', date('d.m.Y'));
564 
565  $tpl->setVariable('TXT_BILL', utf8_decode($this->lng->txt('pays_bill')));
566  $tpl->setVariable('TXT_BILL_NO', utf8_decode($this->lng->txt('pay_bill_no')));
567  $tpl->setVariable('TXT_DATE', utf8_decode($this->lng->txt('date')));
568 
569  $tpl->setVariable('TXT_ARTICLE', utf8_decode($this->lng->txt('pay_article')));
570  $tpl->setVariable('TXT_VAT_RATE', utf8_decode($this->lng->txt('vat_rate')));
571  $tpl->setVariable('TXT_VAT_UNIT', utf8_decode($this->lng->txt('vat_unit')));
572  $tpl->setVariable('TXT_PRICE', utf8_decode($this->lng->txt('price_a')));
573 
574  for ($i = 0; $i < count($bookings['list']); $i++)
575  {
576  $tmp_pobject = new ilPaymentObject($this->user_obj, $bookings['list'][$i]['pobject_id']);
577 
578  $assigned_coupons = '';
579  if (!empty($_SESSION['coupons'][$this->session_var]))
580  {
581  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
582  {
583  $this->coupon_obj->setId($coupon['pc_pk']);
584  $this->coupon_obj->setCurrentCoupon($coupon);
585 
586  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
587  {
588  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
589  }
590  }
591  }
592 
593  $tpl->setCurrentBlock('loop');
594  $tpl->setVariable('LOOP_POSITION', $i+1);
595  $tpl->setVariable('LOOP_AMOUNT', '1');
596  $tpl->setVariable('LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt('period_of_service_provision')));
597 
598  $tpl->setVariable('LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings['list'][$i]['type'])));
599  $tpl->setVariable('LOOP_TITLE',$tmp = utf8_decode($bookings['list'][$i]['title']));
600  $tpl->setVariable('LOOP_COUPON', utf8_decode( $assigned_coupons));
601  $tpl->setVariable('LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt('pay_entitled_retrieve')));
602 
603  if( $bookings['list'][$i]['duration'] == 0 && $bookings['list'][$i]['access_enddate'] == NULL)
604  {
605  $tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration')));
606  }
607  else
608  {
609  $access_startdate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_startdate'], IL_CAL_DATE)));
610  $access_enddate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_enddate'], IL_CAL_DATE)));
611 
612 
613  $tmp_duration = $access_startdate.' - '.$access_enddate;
614  if($bookings['list'][$i]['duration'] > 0)
615  {
616  $tmp_duration .= ' / '.$bookings['list'][$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months'));
617  }
618  $tpl->setVariable('LOOP_DURATION', $tmp_duration);
619  }
620  #$currency = $bookings['list'][$i]['currency_unit'];
621  $tpl->setVariable('LOOP_VAT_RATE', number_format($bookings['list'][$i]['vat_rate'], 2, ',', '.').' %');
622  $tpl->setVariable('LOOP_VAT_UNIT', number_format($bookings['list'][$i]['vat_unit'], 2, ',', '.').' '.$currency);
623  $tpl->setVariable('LOOP_PRICE', number_format($bookings['list'][$i]['price'], 2, ',', '.').' '.$currency);
624  $tpl->setVariable('LOOP_UNIT_PRICE',number_format($bookings['list'][$i]['price'], 2, ',', '.').' '.$currency);
625  $tpl->parseCurrentBlock('loop');
626 
627 
628  $bookings['total'] += (float)$bookings[$i]['price'];
629  $bookings['total_vat']+= (float)$bookings[$i]['vat_unit'];
630  #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
631  unset($tmp_pobject);
632 
633  $sub_total_amount = $bookings['total'];
634  }
635 
636  $bookings['total'] += $bookings['total_discount'];
637  if($bookings['total_discount'] < 0)
638  {
639  $tpl->setCurrentBlock('cloop');
640 
641  $tpl->setVariable('TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_subtotal_amount')));
642  $tpl->setVariable('SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2, ',', '.') . ' ' . $currency);
643 
644  $tpl->setVariable('TXT_COUPON', utf8_decode($this->lng->txt('paya_coupons_coupon')));
645  $tpl->setVariable('BONUS', number_format($bookings['total_discount'], 2, ',', '.') . ' ' . $currency);
646  $tpl->parseCurrentBlock();
647  }
648 
649  if ($bookings['total'] < 0)
650  {
651  $bookings['total'] = 0.00;
652  // $bookings['total_vat'] = 0.0;
653  }
654  $total_net_price = $sub_total_amount-$bookings['total_vat'];
655 
656  $tpl->setVariable('TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt('total_netprice')));
657  $tpl->setVariable('TOTAL_NETPRICE', number_format($total_net_price, 2, ',', '.') . ' ' . $currency);
658 
659  $tpl->setVariable('TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_total_amount')));
660  $tpl->setVariable('TOTAL_AMOUNT', number_format($bookings['total'], 2, ',', '.') . ' ' . $currency);
661  if ($bookings['total_vat'] > 0)
662  {
663  $tpl->setVariable('TOTAL_VAT',number_format( $bookings['total_vat'], 2, ',', '.') . ' ' .$currency);
664  $tpl->setVariable('TXT_TOTAL_VAT', utf8_decode($this->lng->txt('plus_vat')));
665  }
666  if(1 == $bookings['list'][0]['b_pay_method'])
667  {
668  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_unpayed_bill')));
669  }
670  else
671  {
672  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill')));
673  }
674 
675  if (!@file_exists($genSet->get('pdf_path')))
676  {
677 
678  ilUtil::makeDir($genSet->get('pdf_path'));
679  }
680 
681  $file_name = time();
682  if (@file_exists($genSet->get('pdf_path')))
683  {
684  ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $file_name . '.pdf');
685  }
686 
687  if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf') &&
688  $this->user_obj->getEmail() != '' &&
689  $ilSetting->get('admin_email') != '')
690  {
691  $m= new ilMimeMail; // create the mail
692  $m->From( $ilSetting->get('admin_email') );
693  $m->To( $this->user_obj->getEmail() );
694  $m->Subject( $this->lng->txt('pay_message_subject') );
695 
696  // if there is no mailbillingtext use this as standard
697  $message = $this->lng->txt('pay_message_hello') . ' ' . $this->user_obj->getFirstname() . ' ' . $this->user_obj->getLastname() . ",\n\n";
698  $message .= $this->lng->txt('pay_message_thanks') . "\n\n";
699  $message .= $this->lng->txt('pay_message_attachment') . "\n\n";
700  $message .= $this->lng->txt('pay_message_regards') . "\n\n";
701  $message .= strip_tags($genSet->get('address'));
702 
703  //replacePlaceholders...
704  $billing_text = $genSet->getMailBillingText();
705  if(!$billing_text)
706  {
707  $message = '';
708  }
709  if($genSet->getMailUsePlaceholders() == 1)
710  {
711  include_once './Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
712  $message = ilBillingMailPlaceholdersPropertyGUI::replaceBillingMailPlaceholders($billing_text, $this->user_obj->getId());
713  }
714 
715  $m->Body( $message ); // set the body
716  $m->Attach( $genSet->get('pdf_path') . '/' . $file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
717  if($genSet->get('attach_sr_invoice') == 1)
718  {
719  require_once 'Services/RTE/classes/class.ilRTE.php';
720  $regulations = ilRTE::_replaceMediaObjectImageSrc($genSet->get('statutory_regulations'),1);
721  $reg_file_name = 'statutory_regulations';
722  if (@file_exists($genSet->get('pdf_path')))
723  {
724  ilUtil::html2pdf($regulations, $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf');
725  }
726 
727  $m->Attach( $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
728  }
729 
730  $m->Send(); // send the mail
731  }
732 
733  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html');
734  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf');
735 
736  unset($current_booking_id);
737  unset($pobject);
738  unset($_SESSION['coupons'][$this->session_var]);
739 
740  $this->ctrl->redirectByClass('ilShopBoughtObjectsGUI', '');
741  }
742 
744  {
745  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
746 
747  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
748 
749  return $sc_obj->emptyShoppingCart();
750  }
751 
752  function __clearSession()
753  {
754  $_SESSION['coupons'][$this->session_var] = '';
756  }
757 
758  function __loadTemplate()
759  {
760  global $ilTabs;
761 
763 
764  $ilTabs->setTabActive('paya_shopping_cart');
765  $this->tpl->getStandardTemplate();
766  }
767 
768  function __buildStatusline()
769  {
770  $this->tpl->addBlockFile('STATUSLINE', 'statusline', 'tpl.statusline.html');
771 # $this->__buildLocator();
772  }
773 
774  function __buildLocator()
775  {
776  $this->tpl->addBlockFile('LOCATOR', 'locator', 'tpl.locator.html', 'Services/Locator');
777  $this->tpl->setVariable('TXT_LOCATOR',$this->lng->txt('locator'));
778 
779  $this->tpl->setCurrentBlock('locator_item');
780  $this->tpl->setVariable('ITEM', $this->lng->txt('personal_desktop'));
781  $this->tpl->setVariable('LINK_ITEM','../ilias.php?baseClass=ilPersonalDesktopGUI');
782  $this->tpl->parseCurrentBlock();
783 
784  $this->tpl->setCurrentBlock('locator_item');
785  $this->tpl->setVariable('PREFIX','>&nbsp;');
786  $this->tpl->setVariable('ITEM', 'Payment');
787  $this->tpl->setVariable('LINK_ITEM', './payment.php');
788  $this->tpl->parseCurrentBlock();
789 
790  // CHECK for new mail and info
792 
793  return true;
794  }
795 
796  function __buildStylesheet()
797  {
798  $this->tpl->setVariable('LOCATION_STYLESHEET',ilUtil::getStyleSheetLocation());
799  }
800 
804  public function __getCountries()
805  {
806  global $lng;
807 
808  $lng->loadLanguageModule('meta');
809 
810  $cntcodes = array ('DE','ES','FR','GB','AT','CH','AF','AL','DZ','AS','AD','AO',
811  'AI','AQ','AG','AR','AM','AW','AU','AT','AZ','BS','BH','BD','BB','BY',
812  'BE','BZ','BJ','BM','BT','BO','BA','BW','BV','BR','IO','BN','BG','BF',
813  'BI','KH','CM','CA','CV','KY','CF','TD','CL','CN','CX','CC','CO','KM',
814  'CG','CK','CR','CI','HR','CU','CY','CZ','DK','DJ','DM','DO','TP','EC',
815  'EG','SV','GQ','ER','EE','ET','FK','FO','FJ','FI','FR','FX','GF','PF',
816  'TF','GA','GM','GE','DE','GH','GI','GR','GL','GD','GP','GU','GT','GN',
817  'GW','GY','HT','HM','HN','HU','IS','IN','ID','IR','IQ','IE','IL','IT',
818  'JM','JP','JO','KZ','KE','KI','KP','KR','KW','KG','LA','LV','LB','LS',
819  'LR','LY','LI','LT','LU','MO','MK','MG','MW','MY','MV','ML','MT','MH',
820  'MQ','MR','MU','YT','MX','FM','MD','MC','MN','MS','MA','MZ','MM','NA',
821  'NR','NP','NL','AN','NC','NZ','NI','NE','NG','NU','NF','MP','NO','OM',
822  'PK','PW','PA','PG','PY','PE','PH','PN','PL','PT','PR','QA','RE','RO',
823  'RU','RW','KN','LC','VC','WS','SM','ST','SA','CH','SN','SC','SL','SG',
824  'SK','SI','SB','SO','ZA','GS','ES','LK','SH','PM','SD','SR','SJ','SZ',
825  'SE','SY','TW','TJ','TZ','TH','TG','TK','TO','TT','TN','TR','TM','TC',
826  'TV','UG','UA','AE','GB','UY','US','UM','UZ','VU','VA','VE','VN','VG',
827  'VI','WF','EH','YE','ZR','ZM','ZW');
828  $cntrs = array();
829  foreach($cntcodes as $cntcode)
830  {
831  $cntrs[$cntcode] = $lng->txt('meta_c_'.$cntcode);
832  }
833  asort($cntrs);
834  return $cntrs;
835  }
836 
837  public function __getCountryCode($value = '')
838  {
839  $countries = $this->__getCountries();
840  foreach($countries as $code => $text)
841  {
842  if ($text == $value)
843  {
844  return $code;
845  }
846  }
847  return true;
848  }
849 
850  public function __getCountryName($value = '')
851  {
852  $countries = $this->__getCountries();
853  return $countries[$value];
854  }
855 
856  private function __getShoppingCart()
857  {
858  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
859 
860  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
861  {
862  return 0;
863  }
864 
865  $counter = 0;
866  foreach($items as $item)
867  {
868  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
869 
870  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
871  if($tmp_obj)
872  {
873  $f_result[$counter]["object_title"] = $tmp_obj->getTitle();
874  }
875  else
876  {
877  $f_result[$counter]["object_title"] = $this->lng->txt('object_not_found');
878  }
879 
880  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
881 
882  $price = (float) $price_arr['price'];
883  $f_result[$counter]['price'] = $price * 1.0;
884 
885  unset($tmp_obj);
886  unset($tmp_pobject);
887 
888  ++$counter;
889  }
890 
891  return $f_result;
892  }
893 
897  function __getTotalAmount()
898  {
899  $amount = 0;
900 
901  if (is_array($result = $this->__getShoppingCart()))
902  {
903  for ($i = 0; $i < count($result); $i++)
904  {
905  $amount += $result[$i]['price'];
906  }
907  }
908  return $amount;
909  }
910 
911  // if ok, a transaction-id will be generated and the customer gets a bill
912  function getBill()
913  {
914  $this->error = '';
915  ilUtil::sendInfo($this->lng->txt('pay_message_thanks'));
916 
917  $this->__addBookings();
918  }
919 
920  public function __showShoppingCart()
921  {
922  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
923 
925 
926  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
927 
928  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
929  {
930  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
931  }
932 
933  $counter = 0;
934  foreach($items as $item)
935  {
936  $tmp_pobject = new ilPaymentObject($this->user_obj,$item['pobject_id']);
937 
938  $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
939 
940  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
941 
942  $assigned_coupons = '';
943  if (!empty($_SESSION['coupons'][$this->session_var]))
944  {
945  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
946  {
947  $this->coupon_obj->setId($coupon['pc_pk']);
948  $this->coupon_obj->setCurrentCoupon($coupon);
949 
950  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
951  {
952  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
953  }
954  }
955  }
956  $f_result[$counter]['item'] = '';
957  if($tmp_obj)
958  {
959  $f_result[$counter]['title'] = $tmp_obj->getTitle();
960  }
961  else
962  {
963  $f_result[$counter]['title'] = $this->lng->txt('object_not_found');
964  }
965  if ($assigned_coupons != '') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
966 
967  switch($price_arr['price_type'])
968  {
970  $f_result[$counter]['duration'] = $price_arr['duration'] . ' ' . $this->lng->txt('paya_months');
971  break;
973  $f_result[$counter]['duration'] =
974  ilDatePresentation::formatDate(new ilDate($price_arr['duration_from'], IL_CAL_DATE))
975  .' - '.ilDatePresentation::formatDate(new ilDate($price_arr['duration_until'], IL_CAL_DATE));
976  break;
978  $f_result[$counter]['duration'] = $this->lng->txt('unlimited_duration');
979  break;
980  }
981 
982  $oVAT = new ilShopVats((int)$tmp_pobject->getVatId());
983  $f_result[$counter]['vat_rate'] = ilShopUtils::_formatVAT($oVAT->getRate());
984 
985  $float_price = $price_arr['price'];
986 
987  $f_result[$counter]['vat_unit'] = $tmp_pobject->getVat($float_price, 'GUI').' '.$genSet->get('currency_unit');
988  $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
989 
990  $f_result[$counter]['price'] = number_format($float_price, 2, ',', '.') .' '.$genSet->get('currency_unit');
991 
992  unset($tmp_obj);
993  unset($tmp_pobject);
994 
995  ++$counter;
996  }
997 
998  return $this->__showItemsTable($f_result);
999  }
1000 
1001  private function __showItemsTable($a_result_set)
1002  {
1003  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
1004 
1005  $genSet = ilPaymentSettings::_getInstance();
1006  include_once './Services/Payment/classes/class.ilShoppingCartTableGUI.php';
1007 
1008  $tbl = new ilShoppingCartTableGUI($this);
1009  $tbl->setId('tbl_id_'.$this->session_var);
1010  $tbl->setTitle($this->lng->txt('paya_shopping_cart'));
1011  /*
1012  " (".$this->lng->txt('payment_system').": ".
1013  ilPayMethods::getStringByPaymethod($a_pay_method['pm_title']) .")");
1014  */
1015  $tbl->setRowTemplate("tpl.shop_shoppingcart_row.html", "Services/Payment");
1016  $tbl->addColumn('','item','1%');
1017  $tbl->addColumn($this->lng->txt('title'), 'title', '30%');
1018  $tbl->addColumn($this->lng->txt('duration'),'duration', '30%');
1019  $tbl->addColumn($this->lng->txt('vat_rate'), 'vat_rate', '15%');
1020  $tbl->addColumn($this->lng->txt('vat_unit'), 'vat_unit', '15%');
1021  $tbl->addColumn($this->lng->txt('price_a'), 'price', '10%');
1022  $tbl->disable('sort');
1023 
1024  #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
1025 
1026  // show total amount of costs
1027  $sc_obj = new ilPaymentShoppingCart($this->user_obj);
1028  $totalAmount = $sc_obj->getTotalAmount();
1029 
1030  if (!empty($_SESSION['coupons'][$this->session_var]))
1031  {
1032  if (count($items = $sc_obj->getEntries($this->pm_id)))
1033  {
1034  $tbl->setTotalData('TXT_SUB_TOTAL', $this->lng->txt('pay_bmf_subtotal_amount') . ": ");
1035  $tbl->setTotalData('VAL_SUB_TOTAL', number_format($totalAmount[$this->pm_id], 2, ',', '.') . " " . $genSet->get('currency_unit'));
1036  #$tbl->setTotalData('VAL_SUB_TOTAL',ilPaymentPrices::_formatPriceToString($totalAmount[$a_pay_method['pm_id']], (int)$this->default_currency['currency_id'] ));
1037 
1038  $totalAmount[$current_coupon_bonus] = 0;
1039  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
1040  {
1041  $this->coupon_obj->setId($coupon['pc_pk']);
1042  $this->coupon_obj->setCurrentCoupon($coupon);
1043 
1044  $total_object_price = 0.0;
1045  $current_coupon_bonus = 0.0;
1046 
1047  foreach ($items as $item)
1048  {
1049  $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
1050 
1051  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1052  {
1053  $price_data = ilPaymentPrices::_getPrice($item['price_id']);
1054  $price = (float) $price_data['price'];
1055 
1056  $total_object_price += $price;
1057  }
1058  unset($tmp_pobject);
1059  }
1060  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1061  $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * (-1);
1062  }
1063  $tbl->setTotalData('TXT_COUPON_BONUS', $this->lng->txt('paya_coupons_coupon') . ": ");# . $coupon['pcc_code'] . ": ");
1064  $tbl->setTotalData('VAL_COUPON_BONUS', number_format($totalAmount[$current_coupon_bonus], 2, ',', '.') . " " . $genSet->get('currency_unit'));
1065 
1066 
1067  if ($totalAmount[$this->pm_id] < 0)
1068  {
1069  $totalAmount[$this->pm_id] = 0;
1070  $this->totalVat = 0;
1071  }
1072  }
1073  }
1074 
1075  $this->totalAmount[$this->pm_id] = $totalAmount[$this->pm_id]-($totalAmount[$current_coupon_bonus] * (-1));
1076 
1077  $tbl->setTotalData('TXT_TOTAL_AMOUNT', $this->lng->txt('pay_bmf_total_amount').": ");
1078  $tbl->setTotalData('VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$this->pm_id] , 2, ',', '.') . " " . $genSet->get('currency_unit')); #.$item['currency']);
1079 
1080  if ($this->totalVat > 0)
1081  {
1082  $tbl->setTotalData('TXT_TOTAL_VAT', $this->lng->txt('pay_bmf_vat_included') . ": ");
1083  $tbl->setTotalData('VAL_TOTAL_VAT', number_format($this->totalVat , 2, ',', '.') . " " . $genSet->get('currency_unit'));
1084  }
1085 
1086  $tbl->setData($a_result_set);
1087  $this->tpl->setVariable('ITEMS_TABLE',$tbl->getCartHTML());
1088 
1089  return true;
1090  }
1091 
1095  public function getAccess()
1096  {
1097  return $this->access;
1098  }
1099 
1103  public function setAccess($access)
1104  {
1105  $this->access = $access;
1106  }
1107 
1111  public function getPayed()
1112  {
1113  return $this->payed;
1114  }
1115 
1119  public function setPayed($payed)
1120  {
1121  $this->payed = $payed;
1122  }
1123 
1124 }
1125 ?>