Save additional information to the order for successfully sent notification
email and  incorrect sent notification email.

@param bool               $bOrderSend
@param TdbDataMailProfile $oMail
@param string             $sSendToMail
549270
protected function SaveOrderNotificationDataToOrder($bOrderSend, $oMail, $sSendToMail)
    {
        $aData = $this->sqlData;
        if ($bOrderSend && !TGlobal::IsCMSMode()) {
            $aData = $this->AddOrderNotificationDataForOrderSuccess($aData);
        } elseif (!$bOrderSend && !TGlobal::IsCMSMode()) {
            $aData = $this->AddOrderNotificationDataForOrderFailure($aData, $oMail, $sSendToMail);
        }
        $this->LoadFromRow($aData);
        $this->AllowEditByAll(true);
        $this->Save();
        $this->AllowEditByAll(false);
    }
788086
protected function write($data, int $seconds = 0): bool
    {
        if (!$data) {
            return false;
        }

        $this->clean();

        $data = $this->pack($data, $seconds);

        $id = shmop_open($this->id, "n", $this->mode, strlen($data));
        if (!$id) {
            return false;
        }

        $size = shmop_write($id, $data, 0);

        return !empty($size);
    }
1019792
public function SendMail($oArticle = null, $sEmail = '')
    {
        // ------------------------------------------------------------------------
        static $aPortals = array();
        if (null === $oArticle) {
            $oArticle = $this->GetFieldShopArticle();
        }
        if ('' === $sEmail) {
            $sEmail = $this->fieldPreorderUserEmail;
        }
        if (!is_null($oArticle) && !empty($sEmail)) {
            $oMail = TdbDataMailProfile::GetProfile('preorder-available');
            $sArticleDetailLink = $oArticle->GetDetailLink(true);

            if (!array_key_exists($this->fieldCmsPortalId, $aPortals)) {
                $oCMSPortal = TdbCmsPortal::GetNewInstance();
                if ($oCMSPortal->Load($this->fieldCmsPortalId)) {
                    $aPortals[$this->fieldCmsPortalId] = $oCMSPortal;
                }
            }

            $sArticleBasketLink = '';
            if (array_key_exists($this->fieldCmsPortalId, $aPortals)) {
                $sArticleBasketLink = 'http://'.$aPortals[$this->fieldCmsPortalId]->GetPrimaryDomain().'/'.TdbShopArticle::URL_EXTERNAL_TO_BASKET_REQUEST.'/id/'.urlencode($oArticle->id);
            }

            $oMail->AddData('sUserEmail', $sEmail);
            $oMail->AddData('sArticleName', $oArticle->GetName());
            $oMail->AddData('sArticleDetailLink', $sArticleDetailLink);
            $oMail->AddData('sArticleBasketLink', $sArticleBasketLink);

            $oMail->ChangeToAddress($sEmail);
            $oMail->SendUsingObjectView('emails', 'Customer');

            $this->AllowEditByAll(true);
            $this->Delete();
            $this->AllowEditByAll(false);

            return true;
        } else {
            return false;
        }
    }
254459
protected function timeReceiveCheck(EmailSendReceive $emailSendCheckI)
    {
        $timeLeft = time() - $emailSendCheckI->getSentAt()->getTimestamp();
        if ($timeLeft > $this->getReceiveMaxTime()) {
            $emailSendCheckI->setStatus(EmailSendReceive::STATUS_EXPIRED);
            $emailSendCheckI->setReceivedAt(new DateTime());
            throw EmailReceiveCheckException::receivingMaxTimeExpire(
                $emailSendCheckI->getSubject(),
                $timeLeft,
                $this->getReceiveMaxTime()
            );
        }
    }
85486
protected function setSubject(Mail\Message $oMessage, $sSubject)
    {
        if (isset($this->aRendererConfig['subject_prefix']) && $this->aRendererConfig['subject_prefix'] != '') {
            $sSubject = $this->aRendererConfig['subject_prefix'] . $sSubject;
        }

        $oMessage->setSubject($sSubject);

        return $this;
    }
1035349
public function setBorders(PHPRtfLite_Border_Format $borderFormat,
                               $left = true, $top = true, $right = true, $bottom = true)
    {
        $borderFormat->setColorTable($this->_rtf->getColorTable());

        if ($left) {
            $this->_borderLeft  = $borderFormat;
        }

        if ($top) {
            $this->_borderTop   = $borderFormat;
        }

        if ($right) {
            $this->_borderRight = $borderFormat;
        }

        if ($bottom) {
            $this->_borderBottom = $borderFormat;
        }
    }
1137333
protected function setBodyWithAttachments(Mail\Message $oMessage, array $aAttachments, $sHtml, $sPlain)
    {
        $oContent = $this->getContentMessage($sHtml, $sPlain);

        $oContentPart = new Mime\Part($oContent->generateMessage());
        $oContentPart->setType(Mime\Mime::MULTIPART_ALTERNATIVE);
        $oContentPart->setBoundary($oContent->getMime()->boundary());

        $oBody = new Mime\Message();
        $oBody->addPart($oContentPart);

        foreach ($aAttachments as $aAttachmentData) {
            if (isset($aAttachmentData['file_path']) && is_readable($aAttachmentData['file_path'])) {
                $aAttachmentData['file_data'] = file_get_contents($aAttachmentData['file_path']);
            }

            if (isset($aAttachmentData['file_data']) && $aAttachmentData['file_data'] != '') {
                $oAttachment = new Mime\Part();
                $oAttachment
                    ->setContent($aAttachmentData['file_data'])
                    ->setType(Mime\Mime::TYPE_OCTETSTREAM)
                    ->setFileName($aAttachmentData['name'])
                    ->setDisposition(Mime\Mime::DISPOSITION_ATTACHMENT)
                    ->setEncoding(Mime\Mime::ENCODING_BASE64);

                $oBody->addPart($oAttachment);
            }
        }

        $oMessage->setBody($oBody);

        return $this;
    }
405642
function (oModel) {

			var bHasPendingRequest = jQueryDOM.isEmptyObject(oModel.getData());

			//ensure a 1 way binding otherwise it cause any block property change to update the entire subSections
			oModel.setDefaultBindingMode(BindingMode.OneWay);

			var fnHeaderFactory = jQueryDOM.proxy(function () {

				if (bHasPendingRequest) {
					oModel.detachRequestCompleted(fnHeaderFactory);
				}

				var oHeaderTitleContext = new Context(oModel, "/headerTitle"),
					oObjectPageLayout = this.getView().byId("ObjectPageLayout");

				//create the header title if provided in the config
				if (oHeaderTitleContext.getProperty("")) {
					try {
						//retrieve the header class
						this._oHeader = this.controlFactory(oObjectPageLayout.getId(), oHeaderTitleContext);
						oObjectPageLayout.setHeaderTitle(this._oHeader);
					} catch (sError) {
						Log.error("ObjectPageLayoutFactory :: error in header creation from config: " + sError);
					}
				}

			}, this);

			//if data are not there yet, we wait for them
			if (bHasPendingRequest) {
				oModel.attachRequestCompleted(fnHeaderFactory);
			} else { //otherwise we apply the header factory immediately
				fnHeaderFactory();
			}
		}
40996
public function SendPerMail($sToMail, $sToName, $sComment)
    {
        $bSendSuccess = false;
        $oOwner = $this->GetFieldDataExtranetUser();
        $oMail = TdbDataMailProfile::GetProfile('SendWishlist');
        $aMailData = array('to_name' => $sToName, 'to_mail' => $sToMail, 'comment' => $sComment, 'sWishlistURL' => $this->GetPublicLink());
        $oMail->AddDataArray($aMailData);
        $aUserData = $oOwner->GetObjectPropertiesAsArray();
        $oMail->AddDataArray($aUserData);
        $oMail->ChangeFromAddress($oOwner->GetUserEMail(), $oOwner->fieldFirstname.' '.$oOwner->fieldLastname);
        $oMail->ChangeToAddress($sToMail, $sToName);
        if ($oMail->SendUsingObjectView('emails', 'Customer')) {
            $bSendSuccess = true;
            $oHistory = TdbPkgShopWishlistMailHistory::GetNewInstance();
            /** @var $oHistory TdbPkgShopWishlistMailHistory */
            $aData = array('to_name' => $sToName, 'to_email' => $sToMail, 'comment' => $sComment, 'datesend' => date('Y-m-d H:i:s'), 'pkg_shop_wishlist_id' => $this->id);
            $oHistory->LoadFromRow($aData);
            $oHistory->AllowEditByAll(true);
            $oHistory->Save();
        }

        return $bSendSuccess;
    }
158216
public function sendStatusMailToCustomer(TdbShopOrderStatus $oStatus)
    {
        $this->getShopLogger()->info('start sendStatusMailToCustomer');
        $statusCode = $oStatus->GetFieldShopOrderStatusCode();

        if (null !== $statusCode && false === $statusCode->fieldSendMailNotification) {
            $this->getShopLogger()->info('no mail needed');

            return true;
        }

        $oGlobal = TGlobal::instance();
        if ($oGlobal->isCMSMode()) {
            $this->getShopLogger()->info('sending mail using front end action');
            $bSuccess = $this->sendStatusMailToCustomerWithFrontEndAction($oStatus);
            $this->getShopLogger()->info('done sending mail using front end action');
        } else {
            $this->getShopLogger()->info('sending mail classic');
            $oMailProfile = null;
            if ('' !== $statusCode->fieldDataMailProfileId) {
                $oMailProfile = $statusCode->GetFieldDataMailProfile();
                $oMailProfile->SetSubject($oMailProfile->fieldSubject);
            } else {
                $oMailProfile = TdbDataMailProfile::GetProfile(TdbShopOrder::MAIL_STATUS_UPDATE);
            }
            if (null === $oMailProfile) {
                throw new TPkgCmsException_Log(
                    'unable to send update mail because matching profile does not exists: '.TdbShopOrder::MAIL_STATUS_UPDATE,
                    array('oStatus' => $oStatus)
                );
            }
            $oOrder = $oStatus->GetFieldShopOrder();
            $aOrderInfo = $oOrder->GetSQLWithTablePrefix();
            $oMailProfile->AddDataArray($aOrderInfo);
            $aOrderStatusInfo = $oStatus->GetSQLWithTablePrefix();
            $oMailProfile->AddDataArray($aOrderStatusInfo);
            $oViewRenderer = new ViewRenderer();
            $oViewRenderer->AddMapper(new TPkgShopOrderStatusMapper_Status());
            $oViewRenderer->addMapperFromIdentifier('chameleon_system_shop_currency.mapper.shop_currency_mapper');
            $oViewRenderer->AddSourceObject('oObject', $oStatus);
            $sOrderStatusText = $oViewRenderer->Render('/pkgShop/shopOrder/status/oneOrderStatusEntry.html.twig');
            $oMailProfile->AddData('sOrderStatusText', $sOrderStatusText);
            $oMailProfile->ChangeToAddress(
                $oOrder->fieldUserEmail,
                $oOrder->fieldAdrBillingFirstname.' '.$oOrder->fieldAdrBillingLastname
            );
            $this->getShopLogger()->info('sent mail classic');
            $bSuccess = $oMailProfile->SendUsingObjectView('emails', 'Customer');
            $this->getShopLogger()->info('done sending mail classic');
        }

        return $bSuccess;
    }
1139623
private function _sendErrorNotification(&$oRemoteApp, $aResponse)
        {

            $iStatusCode = $aResponse['statuscode'];
            /*
             * Parse template by statuscode
             */
            if ($iStatusCode === 404) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_404_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } elseif ($iStatusCode === 500) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_500_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } elseif ($iStatusCode === 403) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_403_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } else {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            }

            // translate Subject
            $sSubject = $this->getContainer()->get('translator')->trans('system.email.error.' . $iStatusCode . '.subject');

            // get recipients and sender
            $sRecipient = $oRemoteApp->getNotificationRecipient();
            $sSender    = $oRemoteApp->getNotificationSender();
            $sMessage   = \Swift_Message::newInstance()->setSubject($sSubject)->setFrom($sSender)->setTo($sRecipient)->setContentType('text/html')->setBody($sHtml, 'text/html')->addPart($sHtml, 'text/html');

            // send notification
            $this->getContainer()->get('mailer')->send($sMessage);
        }
203602
protected function doSend($messageID = null, $plain = false) {

		$this->extend('onBeforeDoSend', $this);

		if(!$this->Subject() && $this->getUserTemplate()) {
			$this->setSubject($this->getUserTemplate()->Subject);
		}

		$from = $this->From();
		$config = Config::inst()->forClass('Email');

		if(!$from) {
			if($this->getUserTemplate()) {
				$from = $this->getUserTemplate()->From;
			}
			if(!$from) {
				$from = $config->send_all_emails_from ?: $config->admin_email;
			}

			$this->setFrom($from);
		}


		// Check if a list of Member objects has been given
		if($this->members) {
			foreach($this->members as $m) {
				$this->setTo($m->Email);
				$this->populateTemplate(array(
					'RecipientMember' => $m
				));
			}
		}

		if($this->config()->test_mode) {
			$this->parseVariables($plain);
		}
		else {
			if($plain) {
				parent::sendPlain($messageID);
			}
			else {
				parent::send($messageID);
			}
		}

		$this->extend('onAfterDoSend', $this);

		$this->persist();
	}
288733
function(dt) {
      if(!dt.isValid()) {
        if(this.options.errorClass) {
          this.$widget.addClass(this.options.errorClass);
        } else {
          //store original border color
          if(!this.borderColor) {
            this.borderColor = this.$widget.find('select').css('border-color'); 
          }
          this.$widget.find('select').css('border-color', 'red');
        }
      } else {
        if(this.options.errorClass) {
          this.$widget.removeClass(this.options.errorClass);
        } else {
          this.$widget.find('select').css('border-color', this.borderColor);
        }  
      }
    }
277386
public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
    {
        $bPaymentOk = parent::ExecutePayment($oOrder, $sMessageConsumer);

        $aParams = array();
        // payment preauthorization values
        if (isset($_SESSION['3ds_payment'])) {
            $aParams = $_SESSION['3ds_payment'];
            unset($_SESSION['3ds_payment']);
        }

        // execute preauthorization
        $aResponse = $this->PayOnePreauthorization($aParams, $oOrder);
        if ($aResponse['success']) {
            $bPaymentOk = true;
            // reset payOne session
            if (isset($_SESSION['PayOneResponse'])) {
                unset($_SESSION['PayOneResponse']);
            }
        } else {
            $bPaymentOk = false;
        }

        if (!$bPaymentOk) {
            $oMsgManager = TCMSMessageManager::GetInstance();
            $oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => $aResponse['errormessage']));
        }

        return $bPaymentOk;
    }
860483
public function setBorderTop(PHPRtfLite_Border_Format $borderFormat)
    {
        $borderFormat->setColorTable($this->_rtf->getColorTable());
        $this->_borderTop = $borderFormat;
    }
831402
protected function AddOrderNotificationEmailData($aMailData)
    {
        $oLocal = TCMSLocal::GetActive();
        $oTmp = $this->GetFieldAdrBillingCountry();
        $aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_billing_country_name');
        $oTmp = $this->GetFieldAdrBillingSalutation();
        $aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_billing_salutation_name');
        $oTmp = $this->GetFieldAdrShippingCountry();
        $aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_shipping_country_name');
        $oTmp = $this->GetFieldAdrShippingSalutation();
        $aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'adr_shipping_salutation_name');
        $oTmp = $this->GetFieldDataExtranetUser();
        $aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'data_extranet_user_name');
        $oTmp = $this->GetFieldShop();
        $aMailData = $this->AddOrderNotificationEmailDataArray($aMailData, $oTmp, 'shop_name');
        $oTmp = $this->GetFieldShopPaymentMethod();
        if (null !== $oTmp) {
            $aMailData['shop_payment_method_name'] = $oTmp->fieldName;
        }
        $oTmp = $this->GetFieldShopShippingGroup();
        if (null !== $oTmp) {
            $aMailData['shop_shipping_group_name'] = $oTmp->fieldName;
        }

        $aMailData['datecreated'] = $oLocal->FormatDate($this->fieldDatecreated, TCMSLocal::DATEFORMAT_SHOW_DATE);

        return $aMailData;
    }
427707
public function AddVoucher(TdbShopVoucher &$oVoucher, $sMessageHandler)
    {
        $bVoucherAdded = false;
        $oMessageManager = TCMSMessageManager::GetInstance();

        $oVoucherSeries = $oVoucher->GetFieldShopVoucherSeries();
        $aMessageData = $oVoucherSeries->GetObjectPropertiesAsArray();
        $aVoucherData = $oVoucher->GetObjectPropertiesAsArray();
        $aMessageData = array_merge($aMessageData, $aVoucherData);

        $cAllowUseOfVoucherResult = $oVoucher->AllowUseOfVoucher();
        if (TdbShopVoucher::ALLOW_USE != $cAllowUseOfVoucherResult) {
            if (TdbShopVoucher::USE_ERROR_NOT_VALID_FOR_CUSTOMER_GROUP_MISSING_LOGIN == $cAllowUseOfVoucherResult ||
               TdbShopVoucher::USE_ERROR_NOT_VALID_FOR_CUSTOMER_MISSING_LOGIN == $cAllowUseOfVoucherResult) {
                $oExtranet = TdbDataExtranet::GetInstance();
                if (!is_null($oExtranet)) {
                    $aMessageData['sLinkLoginStart'] = '<a href="'.$oExtranet->GetLinkLoginPage().'">';
                    $aMessageData['sLinkLoginEnd'] = '</a>';
                }
            }
            $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ERROR-'.$cAllowUseOfVoucherResult, $aMessageData);
        } else {
            $this->GetActiveVouchers()->AddItem($oVoucher);
            $oMessageManager->AddMessage($sMessageHandler, 'VOUCHER-ADDED', $aMessageData);
            $bVoucherAdded = true;
            $this->SetBasketRecalculationFlag();
        }

        return $bVoucherAdded;
    }