repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVoucher.class.php | TShopVoucher.MarkVoucherAsCompletelyUsed | public function MarkVoucherAsCompletelyUsed()
{
$aData = $this->sqlData;
$aData['date_used_up'] = date('Y-m-d H:i:s');
$aData['is_used_up'] = '1';
$this->LoadFromRow($aData);
$bEditState = $this->bAllowEditByAll;
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll($bEditState);
} | php | public function MarkVoucherAsCompletelyUsed()
{
$aData = $this->sqlData;
$aData['date_used_up'] = date('Y-m-d H:i:s');
$aData['is_used_up'] = '1';
$this->LoadFromRow($aData);
$bEditState = $this->bAllowEditByAll;
$this->AllowEditByAll(true);
$this->Save();
$this->AllowEditByAll($bEditState);
} | [
"public",
"function",
"MarkVoucherAsCompletelyUsed",
"(",
")",
"{",
"$",
"aData",
"=",
"$",
"this",
"->",
"sqlData",
";",
"$",
"aData",
"[",
"'date_used_up'",
"]",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"aData",
"[",
"'is_used_up'",
"]",
"=",
... | mark the voucher as Completely used. | [
"mark",
"the",
"voucher",
"as",
"Completely",
"used",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L455-L465 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopVoucher.class.php | TShopVoucher.AllowVoucherForArticle | public function AllowVoucherForArticle(TShopBasketArticle $oArticle)
{
$bMayBeUsed = true;
$oVoucherDef = &$this->GetFieldShopVoucherSeries();
if ($oArticle->fieldExcludeFromVouchers && empty($oVoucherDef->fieldShopVoucherSeriesSponsorId)) {
$bMayBeUsed = false;
}
// check article restrictions
if ($bMayBeUsed) {
$aArticleRestrictons = $oVoucherDef->GetMLTIdList('shop_article_mlt');
if (count($aArticleRestrictons) > 0 && !in_array($oArticle->id, $aArticleRestrictons)) {
$bMayBeUsed = false;
}
}
// check manufacturer restrictions
if ($bMayBeUsed) {
$aManufacturerRestrictons = $oVoucherDef->GetMLTIdList('shop_manufacturer_mlt');
if (count($aManufacturerRestrictons) > 0 && !in_array($oArticle->fieldShopManufacturerId, $aManufacturerRestrictons)) {
$bMayBeUsed = false;
}
}
// check category restrictions
if ($bMayBeUsed) {
$aCategoryRestrictons = $oVoucherDef->GetMLTIdList('shop_category_mlt');
if (count($aCategoryRestrictons) > 0) {
if (!$oArticle->IsInCategory($aCategoryRestrictons)) {
$bMayBeUsed = false;
}
}
}
// check product group restrictions
if ($bMayBeUsed) {
$aArticleGroupRestrictons = $oVoucherDef->GetMLTIdList('shop_article_group_mlt');
if (count($aArticleGroupRestrictons) > 0) {
$aGroups = $oArticle->GetMLTIdList('shop_article_group_mlt');
$aMatches = array_intersect($aGroups, $aArticleGroupRestrictons);
if (0 == count($aMatches)) {
$bMayBeUsed = false;
}
}
}
return $bMayBeUsed;
} | php | public function AllowVoucherForArticle(TShopBasketArticle $oArticle)
{
$bMayBeUsed = true;
$oVoucherDef = &$this->GetFieldShopVoucherSeries();
if ($oArticle->fieldExcludeFromVouchers && empty($oVoucherDef->fieldShopVoucherSeriesSponsorId)) {
$bMayBeUsed = false;
}
// check article restrictions
if ($bMayBeUsed) {
$aArticleRestrictons = $oVoucherDef->GetMLTIdList('shop_article_mlt');
if (count($aArticleRestrictons) > 0 && !in_array($oArticle->id, $aArticleRestrictons)) {
$bMayBeUsed = false;
}
}
// check manufacturer restrictions
if ($bMayBeUsed) {
$aManufacturerRestrictons = $oVoucherDef->GetMLTIdList('shop_manufacturer_mlt');
if (count($aManufacturerRestrictons) > 0 && !in_array($oArticle->fieldShopManufacturerId, $aManufacturerRestrictons)) {
$bMayBeUsed = false;
}
}
// check category restrictions
if ($bMayBeUsed) {
$aCategoryRestrictons = $oVoucherDef->GetMLTIdList('shop_category_mlt');
if (count($aCategoryRestrictons) > 0) {
if (!$oArticle->IsInCategory($aCategoryRestrictons)) {
$bMayBeUsed = false;
}
}
}
// check product group restrictions
if ($bMayBeUsed) {
$aArticleGroupRestrictons = $oVoucherDef->GetMLTIdList('shop_article_group_mlt');
if (count($aArticleGroupRestrictons) > 0) {
$aGroups = $oArticle->GetMLTIdList('shop_article_group_mlt');
$aMatches = array_intersect($aGroups, $aArticleGroupRestrictons);
if (0 == count($aMatches)) {
$bMayBeUsed = false;
}
}
}
return $bMayBeUsed;
} | [
"public",
"function",
"AllowVoucherForArticle",
"(",
"TShopBasketArticle",
"$",
"oArticle",
")",
"{",
"$",
"bMayBeUsed",
"=",
"true",
";",
"$",
"oVoucherDef",
"=",
"&",
"$",
"this",
"->",
"GetFieldShopVoucherSeries",
"(",
")",
";",
"if",
"(",
"$",
"oArticle",
... | return true if the voucher may be used for the article.
@param TShopBasketArticle $oArticle
@return bool | [
"return",
"true",
"if",
"the",
"voucher",
"may",
"be",
"used",
"for",
"the",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopVoucher.class.php#L474-L523 | train |
PGB-LIV/php-ms | src/Core/Tolerance.php | Tolerance.getDaltonDelta | public function getDaltonDelta($mass)
{
if ($this->unit == Tolerance::DA) {
return $this->tolerance;
}
$toleranceRatio = $this->tolerance / 1000000;
return $mass * $toleranceRatio;
} | php | public function getDaltonDelta($mass)
{
if ($this->unit == Tolerance::DA) {
return $this->tolerance;
}
$toleranceRatio = $this->tolerance / 1000000;
return $mass * $toleranceRatio;
} | [
"public",
"function",
"getDaltonDelta",
"(",
"$",
"mass",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"unit",
"==",
"Tolerance",
"::",
"DA",
")",
"{",
"return",
"$",
"this",
"->",
"tolerance",
";",
"}",
"$",
"toleranceRatio",
"=",
"$",
"this",
"->",
"tol... | Calculates the Dalton tolerance value of this mass using the set tolerance value
@param float $mass
Mass to calculate tolerance for
@return float Tolerance value | [
"Calculates",
"the",
"Dalton",
"tolerance",
"value",
"of",
"this",
"mass",
"using",
"the",
"set",
"tolerance",
"value"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L99-L108 | train |
PGB-LIV/php-ms | src/Core/Tolerance.php | Tolerance.getPpmDelta | public function getPpmDelta($mass)
{
if ($this->unit == Tolerance::PPM) {
return $this->tolerance;
}
$toleranceRatio = $this->tolerance / $mass;
return $toleranceRatio * 1000000;
} | php | public function getPpmDelta($mass)
{
if ($this->unit == Tolerance::PPM) {
return $this->tolerance;
}
$toleranceRatio = $this->tolerance / $mass;
return $toleranceRatio * 1000000;
} | [
"public",
"function",
"getPpmDelta",
"(",
"$",
"mass",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"unit",
"==",
"Tolerance",
"::",
"PPM",
")",
"{",
"return",
"$",
"this",
"->",
"tolerance",
";",
"}",
"$",
"toleranceRatio",
"=",
"$",
"this",
"->",
"toler... | Calculates the ppm tolerance value of this mass using the set tolerance value
@param float $mass
Mass to calculate tolerance for
@return float Tolerance value | [
"Calculates",
"the",
"ppm",
"tolerance",
"value",
"of",
"this",
"mass",
"using",
"the",
"set",
"tolerance",
"value"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L117-L126 | train |
PGB-LIV/php-ms | src/Core/Tolerance.php | Tolerance.isTolerable | public function isTolerable($observed, $expected)
{
$diff = $this->getDifference($observed, $expected);
if ($diff > $this->tolerance) {
return false;
}
return true;
} | php | public function isTolerable($observed, $expected)
{
$diff = $this->getDifference($observed, $expected);
if ($diff > $this->tolerance) {
return false;
}
return true;
} | [
"public",
"function",
"isTolerable",
"(",
"$",
"observed",
",",
"$",
"expected",
")",
"{",
"$",
"diff",
"=",
"$",
"this",
"->",
"getDifference",
"(",
"$",
"observed",
",",
"$",
"expected",
")",
";",
"if",
"(",
"$",
"diff",
">",
"$",
"this",
"->",
"... | Test if the observed and expected values are within the accepted tolerance
@param float $observed
The observed value
@param float $expected
The expected value
@return boolean | [
"Test",
"if",
"the",
"observed",
"and",
"expected",
"values",
"are",
"within",
"the",
"accepted",
"tolerance"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L137-L146 | train |
PGB-LIV/php-ms | src/Core/Tolerance.php | Tolerance.getDifference | public function getDifference($observed, $expected)
{
if ($this->unit == Tolerance::DA) {
return abs($observed - $expected);
}
return abs(self::getDifferencePpm($observed, $expected));
} | php | public function getDifference($observed, $expected)
{
if ($this->unit == Tolerance::DA) {
return abs($observed - $expected);
}
return abs(self::getDifferencePpm($observed, $expected));
} | [
"public",
"function",
"getDifference",
"(",
"$",
"observed",
",",
"$",
"expected",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"unit",
"==",
"Tolerance",
"::",
"DA",
")",
"{",
"return",
"abs",
"(",
"$",
"observed",
"-",
"$",
"expected",
")",
";",
"}",
... | Gets the difference between the observed and expected, and returns it depending on the instance unit
@param float $observed
The observed value
@param float $expected
The expected value
@return float | [
"Gets",
"the",
"difference",
"between",
"the",
"observed",
"and",
"expected",
"and",
"returns",
"it",
"depending",
"on",
"the",
"instance",
"unit"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Core/Tolerance.php#L157-L164 | train |
chameleon-system/chameleon-shop | src/ShopCurrencyBundle/objects/TCMSFields/TPkgShopCurrency_CMSFieldPrice.class.php | TPkgShopCurrency_CMSFieldPrice.RenderFieldPostWakeupString | public function RenderFieldPostWakeupString()
{
$oViewParser = new TViewParser();
/** @var $oViewParser TViewParser */
$oViewParser->bShowTemplatePathAsHTMLHint = false;
$aData = $this->GetFieldWriterData();
$aData['numberOfDecimals'] = $this->_GetNumberOfDecimals();
$oViewParser->AddVarArray($aData);
return $oViewParser->RenderObjectPackageView('postwakeup', 'pkgShopCurrency/views/TCMSFields/TPkgShopCurrency_CMSFieldPrice');
} | php | public function RenderFieldPostWakeupString()
{
$oViewParser = new TViewParser();
/** @var $oViewParser TViewParser */
$oViewParser->bShowTemplatePathAsHTMLHint = false;
$aData = $this->GetFieldWriterData();
$aData['numberOfDecimals'] = $this->_GetNumberOfDecimals();
$oViewParser->AddVarArray($aData);
return $oViewParser->RenderObjectPackageView('postwakeup', 'pkgShopCurrency/views/TCMSFields/TPkgShopCurrency_CMSFieldPrice');
} | [
"public",
"function",
"RenderFieldPostWakeupString",
"(",
")",
"{",
"$",
"oViewParser",
"=",
"new",
"TViewParser",
"(",
")",
";",
"/** @var $oViewParser TViewParser */",
"$",
"oViewParser",
"->",
"bShowTemplatePathAsHTMLHint",
"=",
"false",
";",
"$",
"aData",
"=",
"... | injected into the PostWakeupHook in the auto class.
@return string | [
"injected",
"into",
"the",
"PostWakeupHook",
"in",
"the",
"auto",
"class",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopCurrencyBundle/objects/TCMSFields/TPkgShopCurrency_CMSFieldPrice.class.php#L32-L42 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleReviewList.class.php | TShopArticleReviewList.GetAverageScore | public function GetAverageScore()
{
$dAvgScore = 0;
if ($this->Length() > 0) {
$iPt = $this->getItemPointer();
$this->GoToStart();
$dScore = 0;
while ($oitem = &$this->Next()) {
$dScore += $oitem->fieldRating;
}
$this->setItemPointer($iPt);
$dAvgScore = $dScore / $this->Length();
}
return $dAvgScore;
} | php | public function GetAverageScore()
{
$dAvgScore = 0;
if ($this->Length() > 0) {
$iPt = $this->getItemPointer();
$this->GoToStart();
$dScore = 0;
while ($oitem = &$this->Next()) {
$dScore += $oitem->fieldRating;
}
$this->setItemPointer($iPt);
$dAvgScore = $dScore / $this->Length();
}
return $dAvgScore;
} | [
"public",
"function",
"GetAverageScore",
"(",
")",
"{",
"$",
"dAvgScore",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"Length",
"(",
")",
">",
"0",
")",
"{",
"$",
"iPt",
"=",
"$",
"this",
"->",
"getItemPointer",
"(",
")",
";",
"$",
"this",
"->",... | return the average score for the review list.
@return float | [
"return",
"the",
"average",
"score",
"for",
"the",
"review",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleReviewList.class.php#L28-L44 | train |
chameleon-system/chameleon-shop | src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUserAddress.class.php | TPkgShopDhlPackstation_DataExtranetUserAddress.GetRequiredFields | public function GetRequiredFields()
{
$aRequiredFields = parent::GetRequiredFields();
if ($this->fieldIsDhlPackstation) {
$aRequiredFields[] = 'address_additional_info';
$sKey = array_search('telefon', $aRequiredFields);
if (false !== $sKey) {
unset($aRequiredFields[$sKey]);
}
$sKey = array_search('fax', $aRequiredFields);
if (false !== $sKey) {
unset($aRequiredFields[$sKey]);
}
}
return $aRequiredFields;
} | php | public function GetRequiredFields()
{
$aRequiredFields = parent::GetRequiredFields();
if ($this->fieldIsDhlPackstation) {
$aRequiredFields[] = 'address_additional_info';
$sKey = array_search('telefon', $aRequiredFields);
if (false !== $sKey) {
unset($aRequiredFields[$sKey]);
}
$sKey = array_search('fax', $aRequiredFields);
if (false !== $sKey) {
unset($aRequiredFields[$sKey]);
}
}
return $aRequiredFields;
} | [
"public",
"function",
"GetRequiredFields",
"(",
")",
"{",
"$",
"aRequiredFields",
"=",
"parent",
"::",
"GetRequiredFields",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"fieldIsDhlPackstation",
")",
"{",
"$",
"aRequiredFields",
"[",
"]",
"=",
"'address_additio... | return array with required fields.
@return array | [
"return",
"array",
"with",
"required",
"fields",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopDhlPackstationBundle/pkgExtranet/objects/db/TPkgShopDhlPackstation_DataExtranetUserAddress.class.php#L44-L60 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Fields/Traits/PrimaryKey/AbstractUuidFieldTrait.php | AbstractUuidFieldTrait.injectUuid | public function injectUuid(UuidFactory $uuidFactory)
{
if (null === $this->id) {
$this->setId(self::buildUuid($uuidFactory));
}
} | php | public function injectUuid(UuidFactory $uuidFactory)
{
if (null === $this->id) {
$this->setId(self::buildUuid($uuidFactory));
}
} | [
"public",
"function",
"injectUuid",
"(",
"UuidFactory",
"$",
"uuidFactory",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"id",
")",
"{",
"$",
"this",
"->",
"setId",
"(",
"self",
"::",
"buildUuid",
"(",
"$",
"uuidFactory",
")",
")",
";",
"}"... | This is leveraging the setter injection that happens on Entity creation to ensure that the UUID is set
@param UuidFactory $uuidFactory | [
"This",
"is",
"leveraging",
"the",
"setter",
"injection",
"that",
"happens",
"on",
"Entity",
"creation",
"to",
"ensure",
"that",
"the",
"UUID",
"is",
"set"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Fields/Traits/PrimaryKey/AbstractUuidFieldTrait.php#L25-L30 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleReview.class.php | TShopArticleReview.GetReviewAgeAsString | public function GetReviewAgeAsString()
{
$iNow = time();
$dYear = date('Y', $iNow);
$dMonth = date('n', $iNow);
$dDay = date('j', $iNow);
$dHour = date('G', $iNow);
$dMin = date('i', $iNow);
if ('0' == substr($dMin, 0, 1)) {
$dMin = substr($dMin, 1);
}
$iPreviewDate = strtotime($this->fieldDatecreated);
$dPreviewYear = date('Y', $iPreviewDate);
$dPreviewMonth = date('n', $iPreviewDate);
$dPreviewDay = date('j', $iPreviewDate);
$dPreviewHour = date('G', $iPreviewDate);
$dPreviewMin = date('i', $iPreviewDate);
if ('0' == substr($dPreviewMin, 0, 1)) {
$dPreviewMin = substr($dPreviewMin, 1);
}
$iAgeYear = $dYear - $dPreviewYear;
$iAgeMonth = $dMonth - $dPreviewMonth;
$iAgeDay = $dDay - $dPreviewDay;
$iAgeHour = $dHour - $dPreviewHour;
$iAgeMin = $dMin - $dPreviewMin;
if ($iAgeMin >= 30) {
$iAgeHour += 0.5;
}
$aAgeParts = array();
$oLocal = &TCMSLocal::GetActive();
if ($iAgeYear > 0) {
$sName = 'Jahr';
if ($iAgeYear > 1) {
$sName = 'Jahren';
}
$aAgeParts[] = $iAgeYear.' '.$sName;
}
if ($iAgeMonth > 0) {
$sName = 'Monat';
if ($iAgeMonth > 1) {
$sName = 'Monaten';
}
$aAgeParts[] = $iAgeMonth.' '.$sName;
}
if ($iAgeDay > 0) {
$sName = 'Tag';
if ($iAgeDay > 1) {
$sName = 'Tagen';
}
$aAgeParts[] = $iAgeDay.' '.$sName;
}
if ($iAgeHour > 0) {
if (1 == $iAgeHour) {
$aAgeParts[] = $iAgeDay.' Stunde';
} elseif ($iAgeHour - floor($iAgeHour) > 0) {
$aAgeParts[] = $oLocal->FormatNumber($iAgeHour, 1).' Stunden';
} else {
$aAgeParts[] = $iAgeHour.' Stunden';
}
}
$sAgeString = implode(', ', $aAgeParts);
if (empty($sAgeString)) {
$sAgeString = 'weniger als einer halben Stunde';
}
return $sAgeString;
} | php | public function GetReviewAgeAsString()
{
$iNow = time();
$dYear = date('Y', $iNow);
$dMonth = date('n', $iNow);
$dDay = date('j', $iNow);
$dHour = date('G', $iNow);
$dMin = date('i', $iNow);
if ('0' == substr($dMin, 0, 1)) {
$dMin = substr($dMin, 1);
}
$iPreviewDate = strtotime($this->fieldDatecreated);
$dPreviewYear = date('Y', $iPreviewDate);
$dPreviewMonth = date('n', $iPreviewDate);
$dPreviewDay = date('j', $iPreviewDate);
$dPreviewHour = date('G', $iPreviewDate);
$dPreviewMin = date('i', $iPreviewDate);
if ('0' == substr($dPreviewMin, 0, 1)) {
$dPreviewMin = substr($dPreviewMin, 1);
}
$iAgeYear = $dYear - $dPreviewYear;
$iAgeMonth = $dMonth - $dPreviewMonth;
$iAgeDay = $dDay - $dPreviewDay;
$iAgeHour = $dHour - $dPreviewHour;
$iAgeMin = $dMin - $dPreviewMin;
if ($iAgeMin >= 30) {
$iAgeHour += 0.5;
}
$aAgeParts = array();
$oLocal = &TCMSLocal::GetActive();
if ($iAgeYear > 0) {
$sName = 'Jahr';
if ($iAgeYear > 1) {
$sName = 'Jahren';
}
$aAgeParts[] = $iAgeYear.' '.$sName;
}
if ($iAgeMonth > 0) {
$sName = 'Monat';
if ($iAgeMonth > 1) {
$sName = 'Monaten';
}
$aAgeParts[] = $iAgeMonth.' '.$sName;
}
if ($iAgeDay > 0) {
$sName = 'Tag';
if ($iAgeDay > 1) {
$sName = 'Tagen';
}
$aAgeParts[] = $iAgeDay.' '.$sName;
}
if ($iAgeHour > 0) {
if (1 == $iAgeHour) {
$aAgeParts[] = $iAgeDay.' Stunde';
} elseif ($iAgeHour - floor($iAgeHour) > 0) {
$aAgeParts[] = $oLocal->FormatNumber($iAgeHour, 1).' Stunden';
} else {
$aAgeParts[] = $iAgeHour.' Stunden';
}
}
$sAgeString = implode(', ', $aAgeParts);
if (empty($sAgeString)) {
$sAgeString = 'weniger als einer halben Stunde';
}
return $sAgeString;
} | [
"public",
"function",
"GetReviewAgeAsString",
"(",
")",
"{",
"$",
"iNow",
"=",
"time",
"(",
")",
";",
"$",
"dYear",
"=",
"date",
"(",
"'Y'",
",",
"$",
"iNow",
")",
";",
"$",
"dMonth",
"=",
"date",
"(",
"'n'",
",",
"$",
"iNow",
")",
";",
"$",
"d... | return the age of the review as a string.
@return string | [
"return",
"the",
"age",
"of",
"the",
"review",
"as",
"a",
"string",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleReview.class.php#L26-L97 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopArticleReview.class.php | TShopArticleReview.LoadFromRowProtected | public function LoadFromRowProtected($aRow)
{
$whitelist = $this->getFieldWhitelistForLoadByRow();
$safeData = [];
foreach ($aRow as $key => $val) {
if (\in_array($key, $whitelist, true)) {
$safeData[$key] = $val;
}
}
$user = TdbDataExtranetUser::GetInstance();
if ($user->IsLoggedIn()) {
$safeData['data_extranet_user_id'] = $user->id;
}
$this->LoadFromRow($safeData);
} | php | public function LoadFromRowProtected($aRow)
{
$whitelist = $this->getFieldWhitelistForLoadByRow();
$safeData = [];
foreach ($aRow as $key => $val) {
if (\in_array($key, $whitelist, true)) {
$safeData[$key] = $val;
}
}
$user = TdbDataExtranetUser::GetInstance();
if ($user->IsLoggedIn()) {
$safeData['data_extranet_user_id'] = $user->id;
}
$this->LoadFromRow($safeData);
} | [
"public",
"function",
"LoadFromRowProtected",
"(",
"$",
"aRow",
")",
"{",
"$",
"whitelist",
"=",
"$",
"this",
"->",
"getFieldWhitelistForLoadByRow",
"(",
")",
";",
"$",
"safeData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aRow",
"as",
"$",
"key",
"=>",
... | load data from row, only allowing user-changeable fields.
@param array $aRow | [
"load",
"data",
"from",
"row",
"only",
"allowing",
"user",
"-",
"changeable",
"fields",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopArticleReview.class.php#L156-L170 | train |
edmondscommerce/doctrine-static-meta | src/EntityManager/EntityManagerFactory.php | EntityManagerFactory.getEntityManager | final public function getEntityManager(ConfigInterface $config): EntityManagerInterface
{
try {
$dbParams = $this->getDbConnectionInfo($config);
$doctrineConfig = $this->getDoctrineConfig($config);
$this->addDsmParamsToConfig($doctrineConfig, $config);
$entityManager = $this->createEntityManager($dbParams, $doctrineConfig);
$this->addEntityFactories($entityManager);
$this->setDebuggingInfo($config, $entityManager);
return $entityManager;
} catch (\Exception $e) {
$message = 'Exception in ' . __METHOD__ . ': ' . $e->getMessage();
throw new DoctrineStaticMetaException($message, $e->getCode(), $e);
}
} | php | final public function getEntityManager(ConfigInterface $config): EntityManagerInterface
{
try {
$dbParams = $this->getDbConnectionInfo($config);
$doctrineConfig = $this->getDoctrineConfig($config);
$this->addDsmParamsToConfig($doctrineConfig, $config);
$entityManager = $this->createEntityManager($dbParams, $doctrineConfig);
$this->addEntityFactories($entityManager);
$this->setDebuggingInfo($config, $entityManager);
return $entityManager;
} catch (\Exception $e) {
$message = 'Exception in ' . __METHOD__ . ': ' . $e->getMessage();
throw new DoctrineStaticMetaException($message, $e->getCode(), $e);
}
} | [
"final",
"public",
"function",
"getEntityManager",
"(",
"ConfigInterface",
"$",
"config",
")",
":",
"EntityManagerInterface",
"{",
"try",
"{",
"$",
"dbParams",
"=",
"$",
"this",
"->",
"getDbConnectionInfo",
"(",
"$",
"config",
")",
";",
"$",
"doctrineConfig",
... | This is used to create a new instance of the entity manager. Each of the steps involved need to take place,
however you may wish to make modifications to individual ones. There for the method is final, but the child
steps are public and can be overwritten if you extend the class
@param ConfigInterface $config
@return EntityManagerInterface
@throws DoctrineStaticMetaException | [
"This",
"is",
"used",
"to",
"create",
"a",
"new",
"instance",
"of",
"the",
"entity",
"manager",
".",
"Each",
"of",
"the",
"steps",
"involved",
"need",
"to",
"take",
"place",
"however",
"you",
"may",
"wish",
"to",
"make",
"modifications",
"to",
"individual"... | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L78-L94 | train |
edmondscommerce/doctrine-static-meta | src/EntityManager/EntityManagerFactory.php | EntityManagerFactory.getDbConnectionInfo | public function getDbConnectionInfo(ConfigInterface $config): array
{
$dbUser = $config->get(ConfigInterface::PARAM_DB_USER);
$dbPass = $config->get(ConfigInterface::PARAM_DB_PASS);
$dbHost = $config->get(ConfigInterface::PARAM_DB_HOST);
$dbName = $config->get(ConfigInterface::PARAM_DB_NAME);
$useRetryConnection = $config->get(ConfigInterface::PARAM_USE_RETRY_CONNECTION);
$return = [
'driver' => 'pdo_mysql',
'user' => $dbUser,
'password' => $dbPass,
'dbname' => $dbName,
'host' => $dbHost,
'charset' => 'utf8mb4',
];
if (true === $useRetryConnection) {
$return['wrapperClass'] = PingingAndReconnectingConnection::class;
}
return $return;
} | php | public function getDbConnectionInfo(ConfigInterface $config): array
{
$dbUser = $config->get(ConfigInterface::PARAM_DB_USER);
$dbPass = $config->get(ConfigInterface::PARAM_DB_PASS);
$dbHost = $config->get(ConfigInterface::PARAM_DB_HOST);
$dbName = $config->get(ConfigInterface::PARAM_DB_NAME);
$useRetryConnection = $config->get(ConfigInterface::PARAM_USE_RETRY_CONNECTION);
$return = [
'driver' => 'pdo_mysql',
'user' => $dbUser,
'password' => $dbPass,
'dbname' => $dbName,
'host' => $dbHost,
'charset' => 'utf8mb4',
];
if (true === $useRetryConnection) {
$return['wrapperClass'] = PingingAndReconnectingConnection::class;
}
return $return;
} | [
"public",
"function",
"getDbConnectionInfo",
"(",
"ConfigInterface",
"$",
"config",
")",
":",
"array",
"{",
"$",
"dbUser",
"=",
"$",
"config",
"->",
"get",
"(",
"ConfigInterface",
"::",
"PARAM_DB_USER",
")",
";",
"$",
"dbPass",
"=",
"$",
"config",
"->",
"g... | This is used to get the connection information for doctrine. By default this pulls the information out of the
configuration interface, however if you connection information is in a different format you can override this
method and set it
@param ConfigInterface $config
@return array | [
"This",
"is",
"used",
"to",
"get",
"the",
"connection",
"information",
"for",
"doctrine",
".",
"By",
"default",
"this",
"pulls",
"the",
"information",
"out",
"of",
"the",
"configuration",
"interface",
"however",
"if",
"you",
"connection",
"information",
"is",
... | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L106-L128 | train |
edmondscommerce/doctrine-static-meta | src/EntityManager/EntityManagerFactory.php | EntityManagerFactory.getDoctrineConfig | public function getDoctrineConfig(ConfigInterface $config): Configuration
{
$isDevMode = (bool)$config->get(ConfigInterface::PARAM_DEVMODE);
$proxyDir = $config->get(ConfigInterface::PARAM_DOCTRINE_PROXY_DIR);
$cache = $isDevMode ? null : $this->cache;
return Tools\Setup::createConfiguration($isDevMode, $proxyDir, $cache);
} | php | public function getDoctrineConfig(ConfigInterface $config): Configuration
{
$isDevMode = (bool)$config->get(ConfigInterface::PARAM_DEVMODE);
$proxyDir = $config->get(ConfigInterface::PARAM_DOCTRINE_PROXY_DIR);
$cache = $isDevMode ? null : $this->cache;
return Tools\Setup::createConfiguration($isDevMode, $proxyDir, $cache);
} | [
"public",
"function",
"getDoctrineConfig",
"(",
"ConfigInterface",
"$",
"config",
")",
":",
"Configuration",
"{",
"$",
"isDevMode",
"=",
"(",
"bool",
")",
"$",
"config",
"->",
"get",
"(",
"ConfigInterface",
"::",
"PARAM_DEVMODE",
")",
";",
"$",
"proxyDir",
"... | This is used to get the doctrine configuration object. By default this creates a new instance, however if you
already have an object configured you can override this method and inject it
@param ConfigInterface $config
@return Configuration
@SuppressWarnings(PHPMD.StaticAccess) | [
"This",
"is",
"used",
"to",
"get",
"the",
"doctrine",
"configuration",
"object",
".",
"By",
"default",
"this",
"creates",
"a",
"new",
"instance",
"however",
"if",
"you",
"already",
"have",
"an",
"object",
"configured",
"you",
"can",
"override",
"this",
"meth... | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L139-L146 | train |
edmondscommerce/doctrine-static-meta | src/EntityManager/EntityManagerFactory.php | EntityManagerFactory.addDsmParamsToConfig | public function addDsmParamsToConfig(Configuration $doctrineConfig, ConfigInterface $config): void
{
$paths = $this->getPathInformation($config);
$namingStrategy = $config->get(ConfigInterface::PARAM_DOCTRINE_NAMING_STRATEGY);
$driver = new StaticPHPDriver($paths);
$doctrineConfig->setMetadataDriverImpl($driver);
$doctrineConfig->setNamingStrategy($namingStrategy);
} | php | public function addDsmParamsToConfig(Configuration $doctrineConfig, ConfigInterface $config): void
{
$paths = $this->getPathInformation($config);
$namingStrategy = $config->get(ConfigInterface::PARAM_DOCTRINE_NAMING_STRATEGY);
$driver = new StaticPHPDriver($paths);
$doctrineConfig->setMetadataDriverImpl($driver);
$doctrineConfig->setNamingStrategy($namingStrategy);
} | [
"public",
"function",
"addDsmParamsToConfig",
"(",
"Configuration",
"$",
"doctrineConfig",
",",
"ConfigInterface",
"$",
"config",
")",
":",
"void",
"{",
"$",
"paths",
"=",
"$",
"this",
"->",
"getPathInformation",
"(",
"$",
"config",
")",
";",
"$",
"namingStrat... | This is used to add the DSM specific configuration to doctrine Configuration object. You shouldn't need to
override this, but if you do you can
@param Configuration $doctrineConfig
@param ConfigInterface $config | [
"This",
"is",
"used",
"to",
"add",
"the",
"DSM",
"specific",
"configuration",
"to",
"doctrine",
"Configuration",
"object",
".",
"You",
"shouldn",
"t",
"need",
"to",
"override",
"this",
"but",
"if",
"you",
"do",
"you",
"can"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L155-L162 | train |
edmondscommerce/doctrine-static-meta | src/EntityManager/EntityManagerFactory.php | EntityManagerFactory.createEntityManager | public function createEntityManager(array $dbParams, Configuration $doctrineConfig): EntityManagerInterface
{
$entityManager = EntityManager::create($dbParams, $doctrineConfig);
return new EntityFactoryManagerDecorator($entityManager);
} | php | public function createEntityManager(array $dbParams, Configuration $doctrineConfig): EntityManagerInterface
{
$entityManager = EntityManager::create($dbParams, $doctrineConfig);
return new EntityFactoryManagerDecorator($entityManager);
} | [
"public",
"function",
"createEntityManager",
"(",
"array",
"$",
"dbParams",
",",
"Configuration",
"$",
"doctrineConfig",
")",
":",
"EntityManagerInterface",
"{",
"$",
"entityManager",
"=",
"EntityManager",
"::",
"create",
"(",
"$",
"dbParams",
",",
"$",
"doctrineC... | This is used to create the Entity manager. You can override this if there are any calls you wish to make on it
after it has been created
@param array $dbParams
@param Configuration $doctrineConfig
@return EntityManagerInterface
@throws \Doctrine\ORM\ORMException
@SuppressWarnings(PHPMD.StaticAccess) | [
"This",
"is",
"used",
"to",
"create",
"the",
"Entity",
"manager",
".",
"You",
"can",
"override",
"this",
"if",
"there",
"are",
"any",
"calls",
"you",
"wish",
"to",
"make",
"on",
"it",
"after",
"it",
"has",
"been",
"created"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L192-L197 | train |
edmondscommerce/doctrine-static-meta | src/EntityManager/EntityManagerFactory.php | EntityManagerFactory.setDebuggingInfo | public function setDebuggingInfo(ConfigInterface $config, EntityManagerInterface $entityManager): void
{
$isDbDebug = (bool)$config->get(ConfigInterface::PARAM_DB_DEBUG);
if (false === $isDbDebug) {
return;
}
$connection = $entityManager->getConnection();
$connection->query(
"
set global general_log = 1;
set global log_output = 'table';
truncate general_log;
"
);
} | php | public function setDebuggingInfo(ConfigInterface $config, EntityManagerInterface $entityManager): void
{
$isDbDebug = (bool)$config->get(ConfigInterface::PARAM_DB_DEBUG);
if (false === $isDbDebug) {
return;
}
$connection = $entityManager->getConnection();
$connection->query(
"
set global general_log = 1;
set global log_output = 'table';
truncate general_log;
"
);
} | [
"public",
"function",
"setDebuggingInfo",
"(",
"ConfigInterface",
"$",
"config",
",",
"EntityManagerInterface",
"$",
"entityManager",
")",
":",
"void",
"{",
"$",
"isDbDebug",
"=",
"(",
"bool",
")",
"$",
"config",
"->",
"get",
"(",
"ConfigInterface",
"::",
"PAR... | This is used to set any debugging information, by default it enables MySql logging and clears the log table.
Override this method if there is anything else that you need to do
@param ConfigInterface $config
@param EntityManagerInterface $entityManager
@throws \Doctrine\DBAL\DBALException | [
"This",
"is",
"used",
"to",
"set",
"any",
"debugging",
"information",
"by",
"default",
"it",
"enables",
"MySql",
"logging",
"and",
"clears",
"the",
"log",
"table",
".",
"Override",
"this",
"method",
"if",
"there",
"is",
"anything",
"else",
"that",
"you",
"... | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/EntityManager/EntityManagerFactory.php#L220-L234 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php | SplitShipmentsCheckoutExample.getAuthorizationDetails | public function getAuthorizationDetails($amazonAuthorizationId)
{
$getAuthorizationDetailsRequest = new OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest();
$getAuthorizationDetailsRequest->setSellerId($this->_sellerId);
$getAuthorizationDetailsRequest->setAmazonAuthorizationId($amazonAuthorizationId);
return $this->_service->getAuthorizationDetails($getAuthorizationDetailsRequest);
} | php | public function getAuthorizationDetails($amazonAuthorizationId)
{
$getAuthorizationDetailsRequest = new OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest();
$getAuthorizationDetailsRequest->setSellerId($this->_sellerId);
$getAuthorizationDetailsRequest->setAmazonAuthorizationId($amazonAuthorizationId);
return $this->_service->getAuthorizationDetails($getAuthorizationDetailsRequest);
} | [
"public",
"function",
"getAuthorizationDetails",
"(",
"$",
"amazonAuthorizationId",
")",
"{",
"$",
"getAuthorizationDetailsRequest",
"=",
"new",
"OffAmazonPaymentsService_Model_GetAuthorizationDetailsRequest",
"(",
")",
";",
"$",
"getAuthorizationDetailsRequest",
"->",
"setSell... | Perform the getAuthroizationDetails request for the order
@param string $amazonAuthorizationReferenceId authorization transaction
to query
@return OffAmazonPaymentsService_Model_GetAuthorizationDetailsResponse service response | [
"Perform",
"the",
"getAuthroizationDetails",
"request",
"for",
"the",
"order"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php#L199-L206 | train |
chameleon-system/chameleon-shop | src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php | SplitShipmentsCheckoutExample._getOrderTotal | private function _getOrderTotal()
{
return array_reduce(
$this->_orderShipments,
function($runningTotal, $item) {
$runningTotal += $item->price;
return $runningTotal;
}
);
} | php | private function _getOrderTotal()
{
return array_reduce(
$this->_orderShipments,
function($runningTotal, $item) {
$runningTotal += $item->price;
return $runningTotal;
}
);
} | [
"private",
"function",
"_getOrderTotal",
"(",
")",
"{",
"return",
"array_reduce",
"(",
"$",
"this",
"->",
"_orderShipments",
",",
"function",
"(",
"$",
"runningTotal",
",",
"$",
"item",
")",
"{",
"$",
"runningTotal",
"+=",
"$",
"item",
"->",
"price",
";",
... | Return the total amount for the order
@return int order total | [
"Return",
"the",
"total",
"amount",
"for",
"the",
"order"
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsService/Samples/SplitShipmentsCheckoutExample.php#L295-L304 | train |
edmondscommerce/doctrine-static-meta | src/Schema/Schema.php | Schema.update | public function update(): Schema
{
if ('cli' !== PHP_SAPI) {
throw new \RuntimeException('This should only be called from the command line');
}
$metadata = $this->getAllMetaData();
$schemaUpdateSql = $this->schemaTool->getUpdateSchemaSql($metadata);
if (0 !== count($schemaUpdateSql)) {
$connection = $this->entityManager->getConnection();
foreach ($schemaUpdateSql as $sql) {
try {
$connection->executeQuery($sql);
} catch (DBALException $e) {
throw new DoctrineStaticMetaException(
"exception running update sql:\n$sql\n",
$e->getCode(),
$e
);
}
}
}
$this->generateProxies();
return $this;
} | php | public function update(): Schema
{
if ('cli' !== PHP_SAPI) {
throw new \RuntimeException('This should only be called from the command line');
}
$metadata = $this->getAllMetaData();
$schemaUpdateSql = $this->schemaTool->getUpdateSchemaSql($metadata);
if (0 !== count($schemaUpdateSql)) {
$connection = $this->entityManager->getConnection();
foreach ($schemaUpdateSql as $sql) {
try {
$connection->executeQuery($sql);
} catch (DBALException $e) {
throw new DoctrineStaticMetaException(
"exception running update sql:\n$sql\n",
$e->getCode(),
$e
);
}
}
}
$this->generateProxies();
return $this;
} | [
"public",
"function",
"update",
"(",
")",
":",
"Schema",
"{",
"if",
"(",
"'cli'",
"!==",
"PHP_SAPI",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'This should only be called from the command line'",
")",
";",
"}",
"$",
"metadata",
"=",
"$",
"this"... | Update or Create all tables
@return Schema
@throws \RuntimeException
@throws DoctrineStaticMetaException | [
"Update",
"or",
"Create",
"all",
"tables"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Schema/Schema.php#L77-L101 | train |
edmondscommerce/doctrine-static-meta | src/Schema/Schema.php | Schema.validate | public function validate(): Schema
{
$errors = $this->schemaValidator->validateMapping();
if (!empty($errors)) {
$allMetaData = $this->getAllMetaData();
$mappingPath = __DIR__ . '/../../var/doctrineMapping.ser';
file_put_contents($mappingPath, print_r($allMetaData, true));
throw new DoctrineStaticMetaException(
'Found errors in Doctrine mapping, mapping has been dumped to ' . $mappingPath . "\n\n" . print_r(
$errors,
true
)
);
}
return $this;
} | php | public function validate(): Schema
{
$errors = $this->schemaValidator->validateMapping();
if (!empty($errors)) {
$allMetaData = $this->getAllMetaData();
$mappingPath = __DIR__ . '/../../var/doctrineMapping.ser';
file_put_contents($mappingPath, print_r($allMetaData, true));
throw new DoctrineStaticMetaException(
'Found errors in Doctrine mapping, mapping has been dumped to ' . $mappingPath . "\n\n" . print_r(
$errors,
true
)
);
}
return $this;
} | [
"public",
"function",
"validate",
"(",
")",
":",
"Schema",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"schemaValidator",
"->",
"validateMapping",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"errors",
")",
")",
"{",
"$",
"allMetaData",
"=",
"$"... | Validate the configured mapping metadata
@return Schema
@throws DoctrineStaticMetaException | [
"Validate",
"the",
"configured",
"mapping",
"metadata"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Schema/Schema.php#L130-L146 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.postSelectPaymentHook | public function postSelectPaymentHook(TdbShop $oShop, TShopBasket $oBasket, TdbDataExtranetUser $oUser, $sMessageConsumer)
{
return $this->GetFieldShopPaymentHandler()->PostSelectPaymentHook($sMessageConsumer);
} | php | public function postSelectPaymentHook(TdbShop $oShop, TShopBasket $oBasket, TdbDataExtranetUser $oUser, $sMessageConsumer)
{
return $this->GetFieldShopPaymentHandler()->PostSelectPaymentHook($sMessageConsumer);
} | [
"public",
"function",
"postSelectPaymentHook",
"(",
"TdbShop",
"$",
"oShop",
",",
"TShopBasket",
"$",
"oBasket",
",",
"TdbDataExtranetUser",
"$",
"oUser",
",",
"$",
"sMessageConsumer",
")",
"{",
"return",
"$",
"this",
"->",
"GetFieldShopPaymentHandler",
"(",
")",
... | called after the payment method is selected - return false the selection is invalid.
@param TdbShop $oShop
@param TShopBasket $oBasket
@param TdbDataExtranetUser $oUser
@param $sMessageConsumer
@return bool | [
"called",
"after",
"the",
"payment",
"method",
"is",
"selected",
"-",
"return",
"false",
"the",
"selection",
"is",
"invalid",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L64-L67 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.IsValidForCurrentUser | public function IsValidForCurrentUser()
{
$bIsValidForUser = false;
$bIsValidShippingCountry = false;
$bIsValidBillingCountry = false;
$oUser = TdbDataExtranetUser::GetInstance();
$bIsValidGroup = $this->checkUserGroup($oUser);
if ($bIsValidGroup) {
$bIsValidForUser = $this->checkUser($oUser);
}
if ($bIsValidForUser && $bIsValidGroup) {
$bIsValidShippingCountry = $this->checkUserShippingCountry($oUser);
}
if ($bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry) {
$bIsValidBillingCountry = $this->checkUserBillingCountry($oUser);
}
return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry && $bIsValidBillingCountry;
} | php | public function IsValidForCurrentUser()
{
$bIsValidForUser = false;
$bIsValidShippingCountry = false;
$bIsValidBillingCountry = false;
$oUser = TdbDataExtranetUser::GetInstance();
$bIsValidGroup = $this->checkUserGroup($oUser);
if ($bIsValidGroup) {
$bIsValidForUser = $this->checkUser($oUser);
}
if ($bIsValidForUser && $bIsValidGroup) {
$bIsValidShippingCountry = $this->checkUserShippingCountry($oUser);
}
if ($bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry) {
$bIsValidBillingCountry = $this->checkUserBillingCountry($oUser);
}
return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry && $bIsValidBillingCountry;
} | [
"public",
"function",
"IsValidForCurrentUser",
"(",
")",
"{",
"$",
"bIsValidForUser",
"=",
"false",
";",
"$",
"bIsValidShippingCountry",
"=",
"false",
";",
"$",
"bIsValidBillingCountry",
"=",
"false",
";",
"$",
"oUser",
"=",
"TdbDataExtranetUser",
"::",
"GetInstan... | return true if the payment method is allowed for the current user.
@return bool | [
"return",
"true",
"if",
"the",
"payment",
"method",
"is",
"allowed",
"for",
"the",
"current",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L172-L191 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.checkUserGroup | protected function checkUserGroup(TdbDataExtranetUser $oUser)
{
$bIsValidGroup = false;
$aUserGroups = $this->getPaymentMethodDataAccess()->getPermittedUserGroupIds($this->id);
if (!is_array($aUserGroups) || count($aUserGroups) < 1) {
$bIsValidGroup = true;
} elseif ($oUser->IsLoggedIn()) {
$bIsValidGroup = $oUser->InUserGroups($aUserGroups);
}
return $bIsValidGroup;
} | php | protected function checkUserGroup(TdbDataExtranetUser $oUser)
{
$bIsValidGroup = false;
$aUserGroups = $this->getPaymentMethodDataAccess()->getPermittedUserGroupIds($this->id);
if (!is_array($aUserGroups) || count($aUserGroups) < 1) {
$bIsValidGroup = true;
} elseif ($oUser->IsLoggedIn()) {
$bIsValidGroup = $oUser->InUserGroups($aUserGroups);
}
return $bIsValidGroup;
} | [
"protected",
"function",
"checkUserGroup",
"(",
"TdbDataExtranetUser",
"$",
"oUser",
")",
"{",
"$",
"bIsValidGroup",
"=",
"false",
";",
"$",
"aUserGroups",
"=",
"$",
"this",
"->",
"getPaymentMethodDataAccess",
"(",
")",
"->",
"getPermittedUserGroupIds",
"(",
"$",
... | check user group.
@param TdbDataExtranetUser $oUser
@return bool | [
"check",
"user",
"group",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L200-L211 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.checkUser | protected function checkUser(TdbDataExtranetUser $oUser)
{
$bIsValidForUser = false;
$aUserList = $this->getPaymentMethodDataAccess()->getPermittedUserIds($this->id);
if (!is_array($aUserList) || count($aUserList) < 1) {
$bIsValidForUser = true;
} elseif ($oUser->IsLoggedIn()) {
$bIsValidForUser = in_array($oUser->id, $aUserList);
}
return $bIsValidForUser;
} | php | protected function checkUser(TdbDataExtranetUser $oUser)
{
$bIsValidForUser = false;
$aUserList = $this->getPaymentMethodDataAccess()->getPermittedUserIds($this->id);
if (!is_array($aUserList) || count($aUserList) < 1) {
$bIsValidForUser = true;
} elseif ($oUser->IsLoggedIn()) {
$bIsValidForUser = in_array($oUser->id, $aUserList);
}
return $bIsValidForUser;
} | [
"protected",
"function",
"checkUser",
"(",
"TdbDataExtranetUser",
"$",
"oUser",
")",
"{",
"$",
"bIsValidForUser",
"=",
"false",
";",
"$",
"aUserList",
"=",
"$",
"this",
"->",
"getPaymentMethodDataAccess",
"(",
")",
"->",
"getPermittedUserIds",
"(",
"$",
"this",
... | now check user id.
@param TdbDataExtranetUser $oUser
@return bool | [
"now",
"check",
"user",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L220-L231 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.checkUserShippingCountry | protected function checkUserShippingCountry(TdbDataExtranetUser $oUser)
{
$bIsValidShippingCountry = false;
$aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getShippingCountryIds($this->id);
if (count($aShippingCountryRestriction) > 0) {
$oShippingAddress = $oUser->GetShippingAddress();
if (in_array($oShippingAddress->fieldDataCountryId, $aShippingCountryRestriction)) {
$bIsValidShippingCountry = true;
}
} else {
$bIsValidShippingCountry = true;
}
return $bIsValidShippingCountry;
} | php | protected function checkUserShippingCountry(TdbDataExtranetUser $oUser)
{
$bIsValidShippingCountry = false;
$aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getShippingCountryIds($this->id);
if (count($aShippingCountryRestriction) > 0) {
$oShippingAddress = $oUser->GetShippingAddress();
if (in_array($oShippingAddress->fieldDataCountryId, $aShippingCountryRestriction)) {
$bIsValidShippingCountry = true;
}
} else {
$bIsValidShippingCountry = true;
}
return $bIsValidShippingCountry;
} | [
"protected",
"function",
"checkUserShippingCountry",
"(",
"TdbDataExtranetUser",
"$",
"oUser",
")",
"{",
"$",
"bIsValidShippingCountry",
"=",
"false",
";",
"$",
"aShippingCountryRestriction",
"=",
"$",
"this",
"->",
"getPaymentMethodDataAccess",
"(",
")",
"->",
"getSh... | check shipping country.
@param TdbDataExtranetUser $oUser
@return bool | [
"check",
"shipping",
"country",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L240-L254 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.checkUserBillingCountry | protected function checkUserBillingCountry(TdbDataExtranetUser $oUser)
{
$bIsValidBillingCountry = false;
$aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getBillingCountryIds($this->id);
if (count($aShippingCountryRestriction) > 0) {
$oBillingAddress = $oUser->GetBillingAddress();
if (in_array($oBillingAddress->fieldDataCountryId, $aShippingCountryRestriction)) {
$bIsValidBillingCountry = true;
}
} else {
$bIsValidBillingCountry = true;
}
return $bIsValidBillingCountry;
} | php | protected function checkUserBillingCountry(TdbDataExtranetUser $oUser)
{
$bIsValidBillingCountry = false;
$aShippingCountryRestriction = $this->getPaymentMethodDataAccess()->getBillingCountryIds($this->id);
if (count($aShippingCountryRestriction) > 0) {
$oBillingAddress = $oUser->GetBillingAddress();
if (in_array($oBillingAddress->fieldDataCountryId, $aShippingCountryRestriction)) {
$bIsValidBillingCountry = true;
}
} else {
$bIsValidBillingCountry = true;
}
return $bIsValidBillingCountry;
} | [
"protected",
"function",
"checkUserBillingCountry",
"(",
"TdbDataExtranetUser",
"$",
"oUser",
")",
"{",
"$",
"bIsValidBillingCountry",
"=",
"false",
";",
"$",
"aShippingCountryRestriction",
"=",
"$",
"this",
"->",
"getPaymentMethodDataAccess",
"(",
")",
"->",
"getBill... | check billing country.
@param TdbDataExtranetUser $oUser
@return bool | [
"check",
"billing",
"country",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L271-L285 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.GetPrice | public function GetPrice()
{
if (is_null($this->dPrice)) {
$this->dPrice = 0;
$oBasket = TShopBasket::GetInstance();
if ('absolut' == $this->fieldValueType) {
$this->dPrice = $this->fieldValue;
} else {
$this->dPrice = ($oBasket->dCostArticlesTotalAfterDiscounts * ($this->fieldValue / 100));
}
$this->dPrice = round($this->dPrice, 2);
}
return $this->dPrice;
} | php | public function GetPrice()
{
if (is_null($this->dPrice)) {
$this->dPrice = 0;
$oBasket = TShopBasket::GetInstance();
if ('absolut' == $this->fieldValueType) {
$this->dPrice = $this->fieldValue;
} else {
$this->dPrice = ($oBasket->dCostArticlesTotalAfterDiscounts * ($this->fieldValue / 100));
}
$this->dPrice = round($this->dPrice, 2);
}
return $this->dPrice;
} | [
"public",
"function",
"GetPrice",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"dPrice",
")",
")",
"{",
"$",
"this",
"->",
"dPrice",
"=",
"0",
";",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
... | return payment method cost.
@return float | [
"return",
"payment",
"method",
"cost",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L410-L424 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.GetVat | public function GetVat()
{
$oVat = $this->GetFromInternalCache('ovat');
if (is_null($oVat)) {
$oVat = $this->GetFieldShopVat();
if (is_null($oVat)) {
$oShopConf = TdbShop::GetInstance();
$oVat = $oShopConf->GetVat();
}
$this->SetInternalCache('ovat', $oVat);
}
return $oVat;
} | php | public function GetVat()
{
$oVat = $this->GetFromInternalCache('ovat');
if (is_null($oVat)) {
$oVat = $this->GetFieldShopVat();
if (is_null($oVat)) {
$oShopConf = TdbShop::GetInstance();
$oVat = $oShopConf->GetVat();
}
$this->SetInternalCache('ovat', $oVat);
}
return $oVat;
} | [
"public",
"function",
"GetVat",
"(",
")",
"{",
"$",
"oVat",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'ovat'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oVat",
")",
")",
"{",
"$",
"oVat",
"=",
"$",
"this",
"->",
"GetFieldShopVat",
"(",
... | return the vat group for this payment method.
attention:
vat-logic for payment-methods is currently not implemented in basket!
@return TdbShopVat | [
"return",
"the",
"vat",
"group",
"for",
"this",
"payment",
"method",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L434-L447 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentMethod.class.php | TShopPaymentMethod.processConfirmOrderUserResponse | public function processConfirmOrderUserResponse(TdbDataExtranetUser $user, $userData)
{
if (false === $this->GetFieldShopPaymentHandler() instanceof IPkgShopPaymentHandlerCustomConfirmOrderBlockInterface) {
return true;
}
return $this->GetFieldShopPaymentHandler()->processConfirmOrderUserResponse($this, $user, $userData);
} | php | public function processConfirmOrderUserResponse(TdbDataExtranetUser $user, $userData)
{
if (false === $this->GetFieldShopPaymentHandler() instanceof IPkgShopPaymentHandlerCustomConfirmOrderBlockInterface) {
return true;
}
return $this->GetFieldShopPaymentHandler()->processConfirmOrderUserResponse($this, $user, $userData);
} | [
"public",
"function",
"processConfirmOrderUserResponse",
"(",
"TdbDataExtranetUser",
"$",
"user",
",",
"$",
"userData",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"GetFieldShopPaymentHandler",
"(",
")",
"instanceof",
"IPkgShopPaymentHandlerCustomConfirmOrde... | is called when the user submits the order - allows you do validate and store any data the payment handler requested via renderConfirmOrderBlock.
@param array $userData
@return bool | [
"is",
"called",
"when",
"the",
"user",
"submits",
"the",
"order",
"-",
"allows",
"you",
"do",
"validate",
"and",
"store",
"any",
"data",
"the",
"payment",
"handler",
"requested",
"via",
"renderConfirmOrderBlock",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentMethod.class.php#L522-L529 | train |
chameleon-system/chameleon-shop | src/ImageHotspotBundle/mappers/TPkgImageHotspotMapper.class.php | TPkgImageHotspotMapper.renderObject | protected function renderObject($oTargetObject, $aRenderObjectConfig)
{
$sClassName = get_class($oTargetObject);
if (false === isset($aRenderObjectConfig[$sClassName])) {
return '';
}
$aMapper = $aRenderObjectConfig[$sClassName]['mapper'];
if (false === is_array($aMapper)) {
$aMapper = array($aMapper);
}
$sSnippet = $aRenderObjectConfig[$sClassName]['snippet'];
$oViewRenderer = new ViewRenderer();
foreach ($aMapper as $sMapper) {
if (true === empty($sMapper)) {
continue;
}
$oViewRenderer->addMapperFromIdentifier($sMapper);
}
$oViewRenderer->AddSourceObject('oObject', $oTargetObject);
return $oViewRenderer->Render($sSnippet);
} | php | protected function renderObject($oTargetObject, $aRenderObjectConfig)
{
$sClassName = get_class($oTargetObject);
if (false === isset($aRenderObjectConfig[$sClassName])) {
return '';
}
$aMapper = $aRenderObjectConfig[$sClassName]['mapper'];
if (false === is_array($aMapper)) {
$aMapper = array($aMapper);
}
$sSnippet = $aRenderObjectConfig[$sClassName]['snippet'];
$oViewRenderer = new ViewRenderer();
foreach ($aMapper as $sMapper) {
if (true === empty($sMapper)) {
continue;
}
$oViewRenderer->addMapperFromIdentifier($sMapper);
}
$oViewRenderer->AddSourceObject('oObject', $oTargetObject);
return $oViewRenderer->Render($sSnippet);
} | [
"protected",
"function",
"renderObject",
"(",
"$",
"oTargetObject",
",",
"$",
"aRenderObjectConfig",
")",
"{",
"$",
"sClassName",
"=",
"get_class",
"(",
"$",
"oTargetObject",
")",
";",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"aRenderObjectConfig",
"[",
... | renders hotspot marker layover container content.
@param $oTargetObject
@param array $aRenderObjectConfig
@return string | [
"renders",
"hotspot",
"marker",
"layover",
"container",
"content",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ImageHotspotBundle/mappers/TPkgImageHotspotMapper.class.php#L231-L253 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticleList.class.php | TShopModuleArticleList.UpdateOrderById | public function UpdateOrderById($iId)
{
$this->sqlData['shop_module_articlelist_orderby_id'] = $iId;
$this->fieldShopModuleArticlelistOrderbyId = $iId;
$oItem = null;
$this->SetInternalCache('oLookupshop_module_articlelist_orderby_id', $oItem);
} | php | public function UpdateOrderById($iId)
{
$this->sqlData['shop_module_articlelist_orderby_id'] = $iId;
$this->fieldShopModuleArticlelistOrderbyId = $iId;
$oItem = null;
$this->SetInternalCache('oLookupshop_module_articlelist_orderby_id', $oItem);
} | [
"public",
"function",
"UpdateOrderById",
"(",
"$",
"iId",
")",
"{",
"$",
"this",
"->",
"sqlData",
"[",
"'shop_module_articlelist_orderby_id'",
"]",
"=",
"$",
"iId",
";",
"$",
"this",
"->",
"fieldShopModuleArticlelistOrderbyId",
"=",
"$",
"iId",
";",
"$",
"oIte... | set a new order by id - we need to do this using a method so that we can
reset the internal cache for the connected lookup.
@param int $iId | [
"set",
"a",
"new",
"order",
"by",
"id",
"-",
"we",
"need",
"to",
"do",
"this",
"using",
"a",
"method",
"so",
"that",
"we",
"can",
"reset",
"the",
"internal",
"cache",
"for",
"the",
"connected",
"lookup",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleList.class.php#L20-L26 | train |
chameleon-system/chameleon-shop | src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php | TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.isValidIP | public function isValidIP($sIP)
{
$bAllowed = false;
$sIPSource = trim($this->fieldIpnAllowedIps);
if ('' === $sIPSource) {
return true;
}
$oNetworkHelper = new TPkgCoreUtility_Network();
$aIPList = explode("\n", $sIPSource);
foreach ($aIPList as $sAllowedIP) {
$sRangeType = $oNetworkHelper->getRangeType($sAllowedIP);
switch ($sRangeType) {
case TPkgCoreUtility_Network::IP_RANGE_TYPE_NONE:
$bAllowed = ($sIP === $sAllowedIP);
break;
case TPkgCoreUtility_Network::IP_RANGE_TYPE_RANGE:
case TPkgCoreUtility_Network::IP_RANGE_TYPE_WILDCARD:
case TPkgCoreUtility_Network::IP_RANGE_TYPE_CIDR:
$bAllowed = $oNetworkHelper->ipIsInRange($sIP, $sAllowedIP);
break;
}
if (true === $bAllowed) {
break;
}
}
return $bAllowed;
} | php | public function isValidIP($sIP)
{
$bAllowed = false;
$sIPSource = trim($this->fieldIpnAllowedIps);
if ('' === $sIPSource) {
return true;
}
$oNetworkHelper = new TPkgCoreUtility_Network();
$aIPList = explode("\n", $sIPSource);
foreach ($aIPList as $sAllowedIP) {
$sRangeType = $oNetworkHelper->getRangeType($sAllowedIP);
switch ($sRangeType) {
case TPkgCoreUtility_Network::IP_RANGE_TYPE_NONE:
$bAllowed = ($sIP === $sAllowedIP);
break;
case TPkgCoreUtility_Network::IP_RANGE_TYPE_RANGE:
case TPkgCoreUtility_Network::IP_RANGE_TYPE_WILDCARD:
case TPkgCoreUtility_Network::IP_RANGE_TYPE_CIDR:
$bAllowed = $oNetworkHelper->ipIsInRange($sIP, $sAllowedIP);
break;
}
if (true === $bAllowed) {
break;
}
}
return $bAllowed;
} | [
"public",
"function",
"isValidIP",
"(",
"$",
"sIP",
")",
"{",
"$",
"bAllowed",
"=",
"false",
";",
"$",
"sIPSource",
"=",
"trim",
"(",
"$",
"this",
"->",
"fieldIpnAllowedIps",
")",
";",
"if",
"(",
"''",
"===",
"$",
"sIPSource",
")",
"{",
"return",
"tr... | return true if the ip may send IPN to this payment type.
@param $sIP
@return bool | [
"return",
"true",
"if",
"the",
"ip",
"may",
"send",
"IPN",
"to",
"this",
"payment",
"type",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php#L21-L50 | train |
chameleon-system/chameleon-shop | src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php | TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.handleTransactionHook | protected function handleTransactionHook(IPkgShopPaymentIPNHandler $oHandler, TPkgShopPaymentIPNRequest $oRequest)
{
$oOrder = $oRequest->getOrder();
if (null === $oOrder) {
return;
}
$oTransactionDetails = $oHandler->getIPNTransactionDetails($oRequest);
if (null === $oTransactionDetails) {
return;
}
$oTransactionManager = new TPkgShopPaymentTransactionManager($oOrder);
$sStatus = '';
$oStatus = $oRequest->getIpnStatus();
if (null !== $oStatus) {
$sStatus = $oStatus->fieldCode;
}
$oTransaction = null;
// try to update the corresponding transaction first
if (null !== $oTransactionDetails->getSequenceNumber()) {
$oTransaction = $oTransactionManager->confirmTransaction(
$oTransactionDetails->getSequenceNumber(),
$oTransactionDetails->getTransactionTimestamp()
);
}
if (null === $oTransaction) {
\ChameleonSystem\CoreBundle\ServiceLocator::get('monolog.logger.order_payment_ipn')->warning(
"IPN had transaction data but no matching transaction was found. order-id: {$oOrder->id}, ordernumber: {$oOrder->fieldOrdernumber}",
array('request' => $oRequest->getRequestPayload())
);
}
} | php | protected function handleTransactionHook(IPkgShopPaymentIPNHandler $oHandler, TPkgShopPaymentIPNRequest $oRequest)
{
$oOrder = $oRequest->getOrder();
if (null === $oOrder) {
return;
}
$oTransactionDetails = $oHandler->getIPNTransactionDetails($oRequest);
if (null === $oTransactionDetails) {
return;
}
$oTransactionManager = new TPkgShopPaymentTransactionManager($oOrder);
$sStatus = '';
$oStatus = $oRequest->getIpnStatus();
if (null !== $oStatus) {
$sStatus = $oStatus->fieldCode;
}
$oTransaction = null;
// try to update the corresponding transaction first
if (null !== $oTransactionDetails->getSequenceNumber()) {
$oTransaction = $oTransactionManager->confirmTransaction(
$oTransactionDetails->getSequenceNumber(),
$oTransactionDetails->getTransactionTimestamp()
);
}
if (null === $oTransaction) {
\ChameleonSystem\CoreBundle\ServiceLocator::get('monolog.logger.order_payment_ipn')->warning(
"IPN had transaction data but no matching transaction was found. order-id: {$oOrder->id}, ordernumber: {$oOrder->fieldOrdernumber}",
array('request' => $oRequest->getRequestPayload())
);
}
} | [
"protected",
"function",
"handleTransactionHook",
"(",
"IPkgShopPaymentIPNHandler",
"$",
"oHandler",
",",
"TPkgShopPaymentIPNRequest",
"$",
"oRequest",
")",
"{",
"$",
"oOrder",
"=",
"$",
"oRequest",
"->",
"getOrder",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",... | trigger transaction for the order based on the IPN.
@param IPkgShopPaymentIPNHandler $oHandler
@param TPkgShopPaymentIPNRequest $oRequest | [
"trigger",
"transaction",
"for",
"the",
"order",
"based",
"on",
"the",
"IPN",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopPaymentIPNBundle/objects/db/TPkgShopPaymentIPN_TPkgShopPaymentHandlerGroup.class.php#L103-L138 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php | TShopModuleArticleListFilter.GetNewInstance | public static function GetNewInstance($sData = null, $sLanguage = null)
{
$canBeCached = false;
$cacheKey = null;
if (false === is_array($sData)) {
$canBeCached = true;
$cacheKey = "$sData|$sLanguage";
if (isset(self::$cache[$cacheKey])) {
return clone self::$cache[$cacheKey];
}
}
$oObject = parent:: GetNewInstance($sData, $sLanguage);
if ($oObject && false !== $oObject->sqlData && isset($oObject->sqlData['class']) && !empty($oObject->sqlData['class'])) {
$sClassName = $oObject->sqlData['class'];
$oNewObject = new $sClassName();
$oNewObject->LoadFromRow($oObject->sqlData);
if ($canBeCached) {
self::$cache[$cacheKey] = $oNewObject;
}
return $oNewObject;
}
return $oObject;
} | php | public static function GetNewInstance($sData = null, $sLanguage = null)
{
$canBeCached = false;
$cacheKey = null;
if (false === is_array($sData)) {
$canBeCached = true;
$cacheKey = "$sData|$sLanguage";
if (isset(self::$cache[$cacheKey])) {
return clone self::$cache[$cacheKey];
}
}
$oObject = parent:: GetNewInstance($sData, $sLanguage);
if ($oObject && false !== $oObject->sqlData && isset($oObject->sqlData['class']) && !empty($oObject->sqlData['class'])) {
$sClassName = $oObject->sqlData['class'];
$oNewObject = new $sClassName();
$oNewObject->LoadFromRow($oObject->sqlData);
if ($canBeCached) {
self::$cache[$cacheKey] = $oNewObject;
}
return $oNewObject;
}
return $oObject;
} | [
"public",
"static",
"function",
"GetNewInstance",
"(",
"$",
"sData",
"=",
"null",
",",
"$",
"sLanguage",
"=",
"null",
")",
"{",
"$",
"canBeCached",
"=",
"false",
";",
"$",
"cacheKey",
"=",
"null",
";",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
... | factory creates a new instance and returns it.
@param string|array $sData - either the id of the object to load, or the row with which the instance should be initialized
@param string $sLanguage - init with the language passed
@return TdbShopModuleArticleListFilter | [
"factory",
"creates",
"a",
"new",
"instance",
"and",
"returns",
"it",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php#L37-L62 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php | TShopModuleArticleListFilter.GetGlobalQueryRestrictions | protected function GetGlobalQueryRestrictions($oListConfig)
{
$aRestrictions = array();
$bRestrictToParentArticles = (false == $this->AllowArticleVariants());
$aRestrictions[] = TdbShopArticleList::GetActiveArticleQueryRestriction($bRestrictToParentArticles);
return $aRestrictions;
} | php | protected function GetGlobalQueryRestrictions($oListConfig)
{
$aRestrictions = array();
$bRestrictToParentArticles = (false == $this->AllowArticleVariants());
$aRestrictions[] = TdbShopArticleList::GetActiveArticleQueryRestriction($bRestrictToParentArticles);
return $aRestrictions;
} | [
"protected",
"function",
"GetGlobalQueryRestrictions",
"(",
"$",
"oListConfig",
")",
"{",
"$",
"aRestrictions",
"=",
"array",
"(",
")",
";",
"$",
"bRestrictToParentArticles",
"=",
"(",
"false",
"==",
"$",
"this",
"->",
"AllowArticleVariants",
"(",
")",
")",
";... | query restrictions added to the list.
@param $oListConfig
@return array | [
"query",
"restrictions",
"added",
"to",
"the",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php#L138-L145 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php | TShopModuleArticleListFilter.GetListBaseQueryRestrictedToCategories | protected function GetListBaseQueryRestrictedToCategories(&$oListConfig, $aCategoryList = null)
{
$aCustRestriction = array();
// get category products
$categories = $oListConfig->GetMLTIdList('shop_category_mlt');
$databaseConnection = $this->getDatabaseConnection();
$quotedListConfigId = $databaseConnection->quote($oListConfig->id);
$quotedCategories = implode(',', array_map(array($databaseConnection, 'quote'), $categories));
$sQuery = "SELECT DISTINCT `shop_module_article_list_article`.`name` AS conf_alternativ_header, (-1*`shop_module_article_list_article`.`position`) AS cms_search_weight, `shop_article`.*
FROM `shop_article`
LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`
LEFT JOIN `shop_article_stats` ON `shop_article`.`id` = `shop_article_stats`.`shop_article_id`
LEFT JOIN `shop_article_stock` ON `shop_article`.`id` = `shop_article_stock`.`shop_article_id`
LEFT JOIN `shop_module_article_list_article` ON (`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId AND `shop_article`.`id` = `shop_module_article_list_article`.`shop_article_id`)
";
if (count($categories) > 0) {
$aCustRestriction[] = "`shop_article_shop_category_mlt`.`target_id` IN ($quotedCategories)";
}
$manuallySelectedArticles = &$oListConfig->GetFieldShopModuleArticleListArticleList();
if ($manuallySelectedArticles->Length() > 0) {
$aCustRestriction[] = "`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId";
}
// get warengruppen
$productGroupRestriction = $oListConfig->GetMLTIdList('shop_article_group_mlt');
if (count($productGroupRestriction) > 0) {
$sQuery .= ' LEFT JOIN `shop_article_shop_article_group_mlt` ON `shop_article`.`id` = `shop_article_shop_article_group_mlt`.`source_id` ';
$productGroupRestriction = implode(',', array_map(array($databaseConnection, 'quote'), $productGroupRestriction));
$aCustRestriction[] = "`shop_article_shop_article_group_mlt`.`target_id` IN ($productGroupRestriction)";
}
$sCustQuery = 'WHERE 1=0';
if (count($aCustRestriction) > 0) {
$sCustQuery = 'WHERE ('.implode("\nOR ", $aCustRestriction).')';
}
if (null !== $aCategoryList) {
$escapedCategoryList = implode(',', array_map(array($databaseConnection, 'quote'), $aCategoryList));
$sCustQuery .= " AND (`shop_article_shop_category_mlt`.`target_id` IN ($escapedCategoryList))";
}
$sQuery .= $sCustQuery;
return $sQuery;
} | php | protected function GetListBaseQueryRestrictedToCategories(&$oListConfig, $aCategoryList = null)
{
$aCustRestriction = array();
// get category products
$categories = $oListConfig->GetMLTIdList('shop_category_mlt');
$databaseConnection = $this->getDatabaseConnection();
$quotedListConfigId = $databaseConnection->quote($oListConfig->id);
$quotedCategories = implode(',', array_map(array($databaseConnection, 'quote'), $categories));
$sQuery = "SELECT DISTINCT `shop_module_article_list_article`.`name` AS conf_alternativ_header, (-1*`shop_module_article_list_article`.`position`) AS cms_search_weight, `shop_article`.*
FROM `shop_article`
LEFT JOIN `shop_article_shop_category_mlt` ON `shop_article`.`id` = `shop_article_shop_category_mlt`.`source_id`
LEFT JOIN `shop_article_stats` ON `shop_article`.`id` = `shop_article_stats`.`shop_article_id`
LEFT JOIN `shop_article_stock` ON `shop_article`.`id` = `shop_article_stock`.`shop_article_id`
LEFT JOIN `shop_module_article_list_article` ON (`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId AND `shop_article`.`id` = `shop_module_article_list_article`.`shop_article_id`)
";
if (count($categories) > 0) {
$aCustRestriction[] = "`shop_article_shop_category_mlt`.`target_id` IN ($quotedCategories)";
}
$manuallySelectedArticles = &$oListConfig->GetFieldShopModuleArticleListArticleList();
if ($manuallySelectedArticles->Length() > 0) {
$aCustRestriction[] = "`shop_module_article_list_article`.`shop_module_article_list_id` = $quotedListConfigId";
}
// get warengruppen
$productGroupRestriction = $oListConfig->GetMLTIdList('shop_article_group_mlt');
if (count($productGroupRestriction) > 0) {
$sQuery .= ' LEFT JOIN `shop_article_shop_article_group_mlt` ON `shop_article`.`id` = `shop_article_shop_article_group_mlt`.`source_id` ';
$productGroupRestriction = implode(',', array_map(array($databaseConnection, 'quote'), $productGroupRestriction));
$aCustRestriction[] = "`shop_article_shop_article_group_mlt`.`target_id` IN ($productGroupRestriction)";
}
$sCustQuery = 'WHERE 1=0';
if (count($aCustRestriction) > 0) {
$sCustQuery = 'WHERE ('.implode("\nOR ", $aCustRestriction).')';
}
if (null !== $aCategoryList) {
$escapedCategoryList = implode(',', array_map(array($databaseConnection, 'quote'), $aCategoryList));
$sCustQuery .= " AND (`shop_article_shop_category_mlt`.`target_id` IN ($escapedCategoryList))";
}
$sQuery .= $sCustQuery;
return $sQuery;
} | [
"protected",
"function",
"GetListBaseQueryRestrictedToCategories",
"(",
"&",
"$",
"oListConfig",
",",
"$",
"aCategoryList",
"=",
"null",
")",
"{",
"$",
"aCustRestriction",
"=",
"array",
"(",
")",
";",
"// get category products",
"$",
"categories",
"=",
"$",
"oList... | return a query for all manually assigned articles. this list can be restricted to a list of categories.
@param TdbShopModuleArticleList $oListConfig
@param array $aCategoryList
@return string | [
"return",
"a",
"query",
"for",
"all",
"manually",
"assigned",
"articles",
".",
"this",
"list",
"can",
"be",
"restricted",
"to",
"a",
"list",
"of",
"categories",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopModuleArticleListFilter/TShopModuleArticleListFilter.class.php#L185-L231 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php | TShopPaymentHandlerPayPal.CallPayPalExpressCheckout | protected function CallPayPalExpressCheckout($sMessageConsumer)
{
$oGlobal = TGlobal::instance();
$sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true);
if ('.html' == substr($sReturnURLBase, -5)) {
$sReturnURLBase = substr($sReturnURLBase, 0, -5);
}
if ('/' != substr($sReturnURLBase, -1)) {
$sReturnURLBase .= '/';
}
$sSuccessURL = $sReturnURLBase.self::URL_IDENTIFIER.'success/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$sCancelURL = $sReturnURLBase.self::URL_IDENTIFIER.'cancel/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$oBasket = TShopBasket::GetInstance();
$aParameter = array();
$aParameter['PAYMENTREQUEST_0_AMT'] = number_format($oBasket->dCostTotal, 2); // the total value to charge (use US-Format (1000.00)
$aParameter['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->GetCurrencyIdentifier();
$aParameter['RETURNURL'] = $sSuccessURL; // go to the checkout complete page
$aParameter['CANCELURL'] = $sCancelURL; //urldecode(str_replace('&','&',$oActivePage->GetRealURL(array('paypalreturn'=>'1'),$aExcludes,true))); // return to the cancel page
// styling
$aParameter['HDRIMG'] = ''; // - : specify an image to appear at the top left of the payment page
$aParameter['HDRBORDERCOLOR'] = ''; // - : set the border color around the header of the payment page
$aParameter['HDRBACKCOLOR'] = ''; // - : set the background color for the background of the header of the payment page
$aParameter['PAYFLOWCOLOR'] = ''; // - : set the background color for the payment page
//$aParameter['notify_url'] = $this->GetInstantPaymentNotificationListenerURL(); // instant payment notification url
$logger = $this->getPaypalLogger();
$logger->info('Parameters sent to the PayPal API', $aParameter);
$aResponse = $this->ExecutePayPalCall('SetExpressCheckout', $aParameter);
$sSuccess = false;
// store relevant data in session - and redirect to paypal
if (array_key_exists('ACK', $aResponse)) {
$sAckResponse = strtoupper($aResponse['ACK']);
if ('SUCCESS' == $sAckResponse) {
$this->sPayPalToken = urldecode($aResponse['TOKEN']);
$payPalURL = $this->GetConfigParameter('url').'?cmd=_express-checkout&token='.$this->sPayPalToken;
$this->getRedirect()->redirect($payPalURL);
$sSuccess = true;
}
}
if (!$sSuccess) {
$sResponse = self::GetPayPalErrorMessage($aResponse);
$logger->critical('PayPal payment could not be initiated.', array($sResponse));
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'Error Number: '.$aResponse['L_ERRORCODE0']));
}
return $sSuccess;
} | php | protected function CallPayPalExpressCheckout($sMessageConsumer)
{
$oGlobal = TGlobal::instance();
$sReturnURLBase = $this->getActivePageService()->getActivePage()->GetRealURLPlain(array(), true);
if ('.html' == substr($sReturnURLBase, -5)) {
$sReturnURLBase = substr($sReturnURLBase, 0, -5);
}
if ('/' != substr($sReturnURLBase, -1)) {
$sReturnURLBase .= '/';
}
$sSuccessURL = $sReturnURLBase.self::URL_IDENTIFIER.'success/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$sCancelURL = $sReturnURLBase.self::URL_IDENTIFIER.'cancel/spot_'.$oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$oBasket = TShopBasket::GetInstance();
$aParameter = array();
$aParameter['PAYMENTREQUEST_0_AMT'] = number_format($oBasket->dCostTotal, 2); // the total value to charge (use US-Format (1000.00)
$aParameter['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->GetCurrencyIdentifier();
$aParameter['RETURNURL'] = $sSuccessURL; // go to the checkout complete page
$aParameter['CANCELURL'] = $sCancelURL; //urldecode(str_replace('&','&',$oActivePage->GetRealURL(array('paypalreturn'=>'1'),$aExcludes,true))); // return to the cancel page
// styling
$aParameter['HDRIMG'] = ''; // - : specify an image to appear at the top left of the payment page
$aParameter['HDRBORDERCOLOR'] = ''; // - : set the border color around the header of the payment page
$aParameter['HDRBACKCOLOR'] = ''; // - : set the background color for the background of the header of the payment page
$aParameter['PAYFLOWCOLOR'] = ''; // - : set the background color for the payment page
//$aParameter['notify_url'] = $this->GetInstantPaymentNotificationListenerURL(); // instant payment notification url
$logger = $this->getPaypalLogger();
$logger->info('Parameters sent to the PayPal API', $aParameter);
$aResponse = $this->ExecutePayPalCall('SetExpressCheckout', $aParameter);
$sSuccess = false;
// store relevant data in session - and redirect to paypal
if (array_key_exists('ACK', $aResponse)) {
$sAckResponse = strtoupper($aResponse['ACK']);
if ('SUCCESS' == $sAckResponse) {
$this->sPayPalToken = urldecode($aResponse['TOKEN']);
$payPalURL = $this->GetConfigParameter('url').'?cmd=_express-checkout&token='.$this->sPayPalToken;
$this->getRedirect()->redirect($payPalURL);
$sSuccess = true;
}
}
if (!$sSuccess) {
$sResponse = self::GetPayPalErrorMessage($aResponse);
$logger->critical('PayPal payment could not be initiated.', array($sResponse));
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'Error Number: '.$aResponse['L_ERRORCODE0']));
}
return $sSuccess;
} | [
"protected",
"function",
"CallPayPalExpressCheckout",
"(",
"$",
"sMessageConsumer",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"sReturnURLBase",
"=",
"$",
"this",
"->",
"getActivePageService",
"(",
")",
"->",
"getActivePage",... | return the URL to the IFrame we call in order for paypal to collect the data.
@param string $sMessageConsumer - the name of the message handler that can display messages if an error occurs (assuming you return false)
@return string | [
"return",
"the",
"URL",
"to",
"the",
"IFrame",
"we",
"call",
"in",
"order",
"for",
"paypal",
"to",
"collect",
"the",
"data",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php#L57-L112 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php | TShopPaymentHandlerPayPal.GetPayPalErrorMessage | protected static function GetPayPalErrorMessage($aMessageData)
{
$aMsg = array();
if (array_key_exists('curl_error_no', $aMessageData)) {
$aMsg[] = 'Error Number: '.$aMessageData['curl_error_no'];
$aMsg[] = 'Error Message: '.$aMessageData['curl_error_msg'];
} elseif (count($aMessageData) > 0) {
$aMsg[] = 'Ack: '.$aMessageData['ACK'];
$aMsg[] = 'Correlation ID: '.$aMessageData['CORRELATIONID'];
$aMsg[] = 'Version: '.$aMessageData['VERSION'];
$count = 0;
while (isset($aMessageData['L_SHORTMESSAGE'.$count])) {
$aMsg[] = 'Error Number: '.$aMessageData['L_ERRORCODE'.$count];
$aMsg[] = 'Short Message: '.$aMessageData['L_SHORTMESSAGE'.$count];
$aMsg[] = 'Long Message: '.$aMessageData['L_LONGMESSAGE'.$count];
$count = $count + 1;
}
} else {
$aMsg[] = 'Problem communicating with PayPal. See log for details.';
}
$sMsg = implode("\n", $aMsg);
$sMsg = nl2br($sMsg);
return $sMsg;
} | php | protected static function GetPayPalErrorMessage($aMessageData)
{
$aMsg = array();
if (array_key_exists('curl_error_no', $aMessageData)) {
$aMsg[] = 'Error Number: '.$aMessageData['curl_error_no'];
$aMsg[] = 'Error Message: '.$aMessageData['curl_error_msg'];
} elseif (count($aMessageData) > 0) {
$aMsg[] = 'Ack: '.$aMessageData['ACK'];
$aMsg[] = 'Correlation ID: '.$aMessageData['CORRELATIONID'];
$aMsg[] = 'Version: '.$aMessageData['VERSION'];
$count = 0;
while (isset($aMessageData['L_SHORTMESSAGE'.$count])) {
$aMsg[] = 'Error Number: '.$aMessageData['L_ERRORCODE'.$count];
$aMsg[] = 'Short Message: '.$aMessageData['L_SHORTMESSAGE'.$count];
$aMsg[] = 'Long Message: '.$aMessageData['L_LONGMESSAGE'.$count];
$count = $count + 1;
}
} else {
$aMsg[] = 'Problem communicating with PayPal. See log for details.';
}
$sMsg = implode("\n", $aMsg);
$sMsg = nl2br($sMsg);
return $sMsg;
} | [
"protected",
"static",
"function",
"GetPayPalErrorMessage",
"(",
"$",
"aMessageData",
")",
"{",
"$",
"aMsg",
"=",
"array",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'curl_error_no'",
",",
"$",
"aMessageData",
")",
")",
"{",
"$",
"aMsg",
"[",
"]",... | renders a paypal response error message.
@param $aMessageData
@return string | [
"renders",
"a",
"paypal",
"response",
"error",
"message",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php#L121-L145 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php | TShopPaymentHandlerPayPal.ExecutePayment | public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
{
$bPaymentOk = parent::ExecutePayment($oOrder);
$oCurrency = null;
if (method_exists($oOrder, 'GetFieldPkgShopCurrency')) {
$oCurrency = $oOrder->GetFieldPkgShopCurrency();
}
$sCurrency = $this->GetCurrencyIdentifier($oCurrency);
$request = $this->getCurrentRequest();
$aCommand = array(
'TOKEN' => $this->sPayPalToken,
'PAYERID' => $this->aCheckoutDetails['PAYERID'],
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
'PAYMENTREQUEST_0_AMT' => round($oOrder->fieldValueTotal, 2),
'PAYMENTREQUEST_0_CURRENCYCODE' => $sCurrency,
'IPADDRESS' => null === $request ? '' : $request->getClientIp(),
'PAYMENTREQUEST_0_INVNUM' => $this->GetOrderNumber($oOrder),
'PAYMENTREQUEST_0_CUSTOM' => $this->id.','.$oOrder->id,
);
$sIPNURL = $this->GetInstantPaymentNotificationListenerURL($oOrder);
if (!empty($sIPNURL)) {
$aCommand['PAYMENTREQUEST_0_NOTIFYURL'] = $sIPNURL;
}
$aAnswer = $this->ExecutePayPalCall('DoExpressCheckoutPayment', $aCommand);
$ack = strtoupper($aAnswer['ACK']);
if ('SUCCESS' == $ack) {
$bPaymentOk = true;
// add the response data to the order
foreach ($aAnswer as $sKey => $sVal) {
if (!array_key_exists($sKey, $this->aPaymentUserData)) {
$this->aPaymentUserData[$sKey] = $sVal;
}
}
// $this->SaveUserPaymentDataToOrder($oOrder->id);
if (array_key_exists('PAYMENTINFO_0_PAYMENTSTATUS', $aAnswer) && 'COMPLETED' == strtoupper($aAnswer['PAYMENTINFO_0_PAYMENTSTATUS'])) {
$oOrder->SetStatusPaid();
}
} else {
$bPaymentOk = false;
}
if (!$bPaymentOk) {
// error!
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => self::GetPayPalErrorMessage($aAnswer)));
$logContext = array(
'Command' => $aCommand,
'PayPalAnswer' => $aAnswer,
);
$this->getPaypalLogger()->critical('PayPal payment could not be executed for order id '.$oOrder->id, $logContext);
}
return $bPaymentOk;
} | php | public function ExecutePayment(TdbShopOrder &$oOrder, $sMessageConsumer = '')
{
$bPaymentOk = parent::ExecutePayment($oOrder);
$oCurrency = null;
if (method_exists($oOrder, 'GetFieldPkgShopCurrency')) {
$oCurrency = $oOrder->GetFieldPkgShopCurrency();
}
$sCurrency = $this->GetCurrencyIdentifier($oCurrency);
$request = $this->getCurrentRequest();
$aCommand = array(
'TOKEN' => $this->sPayPalToken,
'PAYERID' => $this->aCheckoutDetails['PAYERID'],
'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale',
'PAYMENTREQUEST_0_AMT' => round($oOrder->fieldValueTotal, 2),
'PAYMENTREQUEST_0_CURRENCYCODE' => $sCurrency,
'IPADDRESS' => null === $request ? '' : $request->getClientIp(),
'PAYMENTREQUEST_0_INVNUM' => $this->GetOrderNumber($oOrder),
'PAYMENTREQUEST_0_CUSTOM' => $this->id.','.$oOrder->id,
);
$sIPNURL = $this->GetInstantPaymentNotificationListenerURL($oOrder);
if (!empty($sIPNURL)) {
$aCommand['PAYMENTREQUEST_0_NOTIFYURL'] = $sIPNURL;
}
$aAnswer = $this->ExecutePayPalCall('DoExpressCheckoutPayment', $aCommand);
$ack = strtoupper($aAnswer['ACK']);
if ('SUCCESS' == $ack) {
$bPaymentOk = true;
// add the response data to the order
foreach ($aAnswer as $sKey => $sVal) {
if (!array_key_exists($sKey, $this->aPaymentUserData)) {
$this->aPaymentUserData[$sKey] = $sVal;
}
}
// $this->SaveUserPaymentDataToOrder($oOrder->id);
if (array_key_exists('PAYMENTINFO_0_PAYMENTSTATUS', $aAnswer) && 'COMPLETED' == strtoupper($aAnswer['PAYMENTINFO_0_PAYMENTSTATUS'])) {
$oOrder->SetStatusPaid();
}
} else {
$bPaymentOk = false;
}
if (!$bPaymentOk) {
// error!
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => self::GetPayPalErrorMessage($aAnswer)));
$logContext = array(
'Command' => $aCommand,
'PayPalAnswer' => $aAnswer,
);
$this->getPaypalLogger()->critical('PayPal payment could not be executed for order id '.$oOrder->id, $logContext);
}
return $bPaymentOk;
} | [
"public",
"function",
"ExecutePayment",
"(",
"TdbShopOrder",
"&",
"$",
"oOrder",
",",
"$",
"sMessageConsumer",
"=",
"''",
")",
"{",
"$",
"bPaymentOk",
"=",
"parent",
"::",
"ExecutePayment",
"(",
"$",
"oOrder",
")",
";",
"$",
"oCurrency",
"=",
"null",
";",
... | executes payment for order - in this case, we commit the paypal payment.
@param TdbShopOrder $oOrder
@param string $sMessageConsumer - send error messages here
@return bool | [
"executes",
"payment",
"for",
"order",
"-",
"in",
"this",
"case",
"we",
"commit",
"the",
"paypal",
"payment",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerPayPal.class.php#L178-L234 | train |
chameleon-system/chameleon-shop | src/ShopRatingServiceBundle/objects/webmodules/MTRatingServiceWidget/MTRatingServiceWidgetCore.class.php | MTRatingServiceWidgetCore.GetRatingService | protected function GetRatingService()
{
$oRatingServiceItem = null;
if (!empty($this->oModuleConfig->fieldPkgShopRatingServiceId)) {
$oRatingServiceItem = TdbPkgShopRatingService::GetNewInstance($this->oModuleConfig->fieldPkgShopRatingServiceId);
}
return $oRatingServiceItem;
} | php | protected function GetRatingService()
{
$oRatingServiceItem = null;
if (!empty($this->oModuleConfig->fieldPkgShopRatingServiceId)) {
$oRatingServiceItem = TdbPkgShopRatingService::GetNewInstance($this->oModuleConfig->fieldPkgShopRatingServiceId);
}
return $oRatingServiceItem;
} | [
"protected",
"function",
"GetRatingService",
"(",
")",
"{",
"$",
"oRatingServiceItem",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"oModuleConfig",
"->",
"fieldPkgShopRatingServiceId",
")",
")",
"{",
"$",
"oRatingServiceItem",
"=",
"TdbP... | Select right RatingService object.
@return TdbPkgShopRatingService|null | [
"Select",
"right",
"RatingService",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopRatingServiceBundle/objects/webmodules/MTRatingServiceWidget/MTRatingServiceWidgetCore.class.php#L37-L45 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php | TShopBasketArticleCore.ResetDiscounts | public function ResetDiscounts()
{
$this->oActingShopDiscountList = null;
$this->dPriceAfterDiscount = $this->dPrice;
$this->dPriceTotalAfterDiscount = $this->dPriceTotal;
$this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount;
$this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount;
} | php | public function ResetDiscounts()
{
$this->oActingShopDiscountList = null;
$this->dPriceAfterDiscount = $this->dPrice;
$this->dPriceTotalAfterDiscount = $this->dPriceTotal;
$this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount;
$this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount;
} | [
"public",
"function",
"ResetDiscounts",
"(",
")",
"{",
"$",
"this",
"->",
"oActingShopDiscountList",
"=",
"null",
";",
"$",
"this",
"->",
"dPriceAfterDiscount",
"=",
"$",
"this",
"->",
"dPrice",
";",
"$",
"this",
"->",
"dPriceTotalAfterDiscount",
"=",
"$",
"... | remove acting discounts. | [
"remove",
"acting",
"discounts",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L119-L126 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php | TShopBasketArticleCore.ApplyDiscount | public function ApplyDiscount(TdbShopDiscount $oShopDiscount, $dMaxValueUsable = 0)
{
$dRemainingValue = 0;
if (is_null($this->oActingShopDiscountList)) {
$this->oActingShopDiscountList = new TShopBasketArticleDiscountList();
}
if ('absolut' == $oShopDiscount->fieldValueType) {
$dUsedValue = $dMaxValueUsable;
if ($this->dPriceTotalAfterDiscount < $dUsedValue) {
$dUsedValue = $this->dPriceTotalAfterDiscount;
$dRemainingValue = $dMaxValueUsable - $this->dPriceTotalAfterDiscount;
}
$oShopDiscount->dRealValueUsed = $dUsedValue;
} else {
$oShopDiscount->dRealValueUsed = round($this->dPriceTotalAfterDiscount * ($oShopDiscount->fieldValue / 100), 2);
}
$this->dPriceTotalAfterDiscount = $this->dPriceTotalAfterDiscount - $oShopDiscount->dRealValueUsed;
$this->dPriceAfterDiscount = $this->dPriceTotalAfterDiscount / $this->dAmount;
$this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount;
$this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount;
$this->oActingShopDiscountList->AddItem($oShopDiscount);
return $dRemainingValue;
} | php | public function ApplyDiscount(TdbShopDiscount $oShopDiscount, $dMaxValueUsable = 0)
{
$dRemainingValue = 0;
if (is_null($this->oActingShopDiscountList)) {
$this->oActingShopDiscountList = new TShopBasketArticleDiscountList();
}
if ('absolut' == $oShopDiscount->fieldValueType) {
$dUsedValue = $dMaxValueUsable;
if ($this->dPriceTotalAfterDiscount < $dUsedValue) {
$dUsedValue = $this->dPriceTotalAfterDiscount;
$dRemainingValue = $dMaxValueUsable - $this->dPriceTotalAfterDiscount;
}
$oShopDiscount->dRealValueUsed = $dUsedValue;
} else {
$oShopDiscount->dRealValueUsed = round($this->dPriceTotalAfterDiscount * ($oShopDiscount->fieldValue / 100), 2);
}
$this->dPriceTotalAfterDiscount = $this->dPriceTotalAfterDiscount - $oShopDiscount->dRealValueUsed;
$this->dPriceAfterDiscount = $this->dPriceTotalAfterDiscount / $this->dAmount;
$this->dPriceAfterDiscountWithoutVouchers = $this->dPriceAfterDiscount;
$this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount;
$this->oActingShopDiscountList->AddItem($oShopDiscount);
return $dRemainingValue;
} | [
"public",
"function",
"ApplyDiscount",
"(",
"TdbShopDiscount",
"$",
"oShopDiscount",
",",
"$",
"dMaxValueUsable",
"=",
"0",
")",
"{",
"$",
"dRemainingValue",
"=",
"0",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"oActingShopDiscountList",
")",
")",
"{... | apply a discount to the article (note that the method will not check if the discount
may be applied - it assumes you checked that using the function in TShopDiscount.
@param TdbShopDiscount $oShopDiscount
@param dobule $dMaxValueUsable - for absolute value discounts, this parameter defines how much may be at most applied to the article
@return float - returns the remaining discount value to distribute (0 if the discount is a percent discount) | [
"apply",
"a",
"discount",
"to",
"the",
"article",
"(",
"note",
"that",
"the",
"method",
"will",
"not",
"check",
"if",
"the",
"discount",
"may",
"be",
"applied",
"-",
"it",
"assumes",
"you",
"checked",
"that",
"using",
"the",
"function",
"in",
"TShopDiscoun... | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L137-L161 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php | TShopBasketArticleCore.GetRemoveFromBasketLink | public function GetRemoveFromBasketLink()
{
$activeShop = $this->getShopService()->getActiveShop();
$aParameters = array('module_fnc['.$activeShop->GetBasketModuleSpotName().']' => 'RemoveFromBasketViaBasketItemKey', MTShopBasketCore::URL_ITEM_BASKET_KEY => $this->sBasketItemKey, MTShopBasketCore::URL_MESSAGE_CONSUMER => MTShopBasketCore::MSG_CONSUMER_NAME);
return $this->getActivePageService()->getLinkToActivePageRelative($aParameters);
} | php | public function GetRemoveFromBasketLink()
{
$activeShop = $this->getShopService()->getActiveShop();
$aParameters = array('module_fnc['.$activeShop->GetBasketModuleSpotName().']' => 'RemoveFromBasketViaBasketItemKey', MTShopBasketCore::URL_ITEM_BASKET_KEY => $this->sBasketItemKey, MTShopBasketCore::URL_MESSAGE_CONSUMER => MTShopBasketCore::MSG_CONSUMER_NAME);
return $this->getActivePageService()->getLinkToActivePageRelative($aParameters);
} | [
"public",
"function",
"GetRemoveFromBasketLink",
"(",
")",
"{",
"$",
"activeShop",
"=",
"$",
"this",
"->",
"getShopService",
"(",
")",
"->",
"getActiveShop",
"(",
")",
";",
"$",
"aParameters",
"=",
"array",
"(",
"'module_fnc['",
".",
"$",
"activeShop",
"->",... | returns the link to remove this item from the basket.
@return string | [
"returns",
"the",
"link",
"to",
"remove",
"this",
"item",
"from",
"the",
"basket",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L213-L219 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php | TShopBasketArticleCore.UpdateItemInfo | protected function UpdateItemInfo()
{
$this->dPriceTotal = $this->dAmount * $this->dPrice;
$this->dTotalWeight = $this->dAmount * $this->fieldSizeWeight;
$this->dTotalVolume = $this->dAmount * $this->dVolume;
$this->dPriceAfterDiscount = $this->dPrice;
$this->dPriceTotalAfterDiscount = $this->dPriceTotal;
$this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount;
} | php | protected function UpdateItemInfo()
{
$this->dPriceTotal = $this->dAmount * $this->dPrice;
$this->dTotalWeight = $this->dAmount * $this->fieldSizeWeight;
$this->dTotalVolume = $this->dAmount * $this->dVolume;
$this->dPriceAfterDiscount = $this->dPrice;
$this->dPriceTotalAfterDiscount = $this->dPriceTotal;
$this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount;
} | [
"protected",
"function",
"UpdateItemInfo",
"(",
")",
"{",
"$",
"this",
"->",
"dPriceTotal",
"=",
"$",
"this",
"->",
"dAmount",
"*",
"$",
"this",
"->",
"dPrice",
";",
"$",
"this",
"->",
"dTotalWeight",
"=",
"$",
"this",
"->",
"dAmount",
"*",
"$",
"this"... | update the price total of the object. | [
"update",
"the",
"price",
"total",
"of",
"the",
"object",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L241-L249 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php | TShopBasketArticleCore.RefreshDataFromDatabase | public function RefreshDataFromDatabase()
{
$this->ClearInternalCache();
$sActiveLanguageId = self::getLanguageService()->getActiveLanguageId();
if (null !== $sActiveLanguageId) {
$this->SetLanguage($sActiveLanguageId);
}
$bEnableObjectCaching = $this->GetEnableObjectCaching();
$this->SetEnableObjectCaching(false);
$this->Load($this->id);
$this->SetEnableObjectCaching($bEnableObjectCaching);
} | php | public function RefreshDataFromDatabase()
{
$this->ClearInternalCache();
$sActiveLanguageId = self::getLanguageService()->getActiveLanguageId();
if (null !== $sActiveLanguageId) {
$this->SetLanguage($sActiveLanguageId);
}
$bEnableObjectCaching = $this->GetEnableObjectCaching();
$this->SetEnableObjectCaching(false);
$this->Load($this->id);
$this->SetEnableObjectCaching($bEnableObjectCaching);
} | [
"public",
"function",
"RefreshDataFromDatabase",
"(",
")",
"{",
"$",
"this",
"->",
"ClearInternalCache",
"(",
")",
";",
"$",
"sActiveLanguageId",
"=",
"self",
"::",
"getLanguageService",
"(",
")",
"->",
"getActiveLanguageId",
"(",
")",
";",
"if",
"(",
"null",
... | reloads the article data from database if called. | [
"reloads",
"the",
"article",
"data",
"from",
"database",
"if",
"called",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TShopBasket/TShopBasketArticleCore.class.php#L323-L334 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/TCMSInterface/TShopInterfaceExportCustomers.class.php | TShopInterfaceExportCustomers.GetDataList | protected function GetDataList()
{
$query = 'SELECT `data_extranet_user`.`id` AS UserId,
`data_extranet_user`.`name` AS EMail,
`data_extranet_user`.`customer_number` AS KundenNr,
`data_extranet_user`.`datecreated`,
`pkg_newsletter_user`.`signup_date` AS NewsletterAnmeldedatum,
AdrB.`company` AS RechAdr_Firma,
AdrBSalutation.`name` AS RechAdr_Anrede,
AdrB.`firstname` AS RechAdr_Vorname,
AdrB.`lastname` AS RechAdr_Nachname,
AdrB.`street` AS RechAdr_Strasse,
AdrB.`streetnr` AS RechAdr_Hausnummer,
AdrB.`city` AS RechAdr_Stadt,
AdrB.`postalcode` AS RechAdr_PLZ,
AdrB.`telefon` AS RechAdr_Telefon,
AdrB.`fax` AS RechAdr_Fax,
AdrBCountry.`name` AS RechAdr_Land,
AdrS.`company` AS LiefAdr_Firma,
AdrSSalutation.`name` AS LiefAdr_Anrede,
AdrS.`firstname` AS LiefAdr_Vorname,
AdrS.`lastname` AS LiefAdr_Nachname,
AdrS.`street` AS LiefAdr_Strasse,
AdrS.`streetnr` AS LiefAdr_Hausnummer,
AdrS.`city` AS LiefAdr_Stadt,
AdrS.`postalcode` AS LiefAdr_PLZ,
AdrS.`telefon` AS LiefAdr_Telefon,
AdrS.`fax` AS LiefAdr_Fax,
AdrSCountry.`name` AS LiefAdr_Land
FROM `data_extranet_user`
LEFT JOIN `data_extranet_user_address` AS AdrB ON (`data_extranet_user`.`default_billing_address_id` = AdrB.`id`)
LEFT JOIN `data_extranet_salutation` AS AdrBSalutation ON AdrB.`data_extranet_salutation_id` = AdrBSalutation.`id`
LEFT JOIN `data_country` AS AdrBCountry ON AdrB.`data_country_id` = AdrBCountry.`id`
LEFT JOIN `data_extranet_user_address` AS AdrS ON (`data_extranet_user`.`default_shipping_address_id` = AdrS.`id`)
LEFT JOIN `data_extranet_salutation` AS AdrSSalutation ON AdrB.`data_extranet_salutation_id` = AdrSSalutation.`id`
LEFT JOIN `data_country` AS AdrSCountry ON AdrS.`data_country_id` = AdrSCountry.`id`
LEFT JOIN `pkg_newsletter_user` ON (`data_extranet_user`.`id` = `pkg_newsletter_user`.`data_extranet_user_id`)
';
$oTCMSRecordList = new TCMSRecordList();
/** @var $oTCMSRecordList TCMSRecordList */
$oTCMSRecordList->sTableName = 'data_extranet_user';
$oTCMSRecordList->Load($query);
return $oTCMSRecordList;
} | php | protected function GetDataList()
{
$query = 'SELECT `data_extranet_user`.`id` AS UserId,
`data_extranet_user`.`name` AS EMail,
`data_extranet_user`.`customer_number` AS KundenNr,
`data_extranet_user`.`datecreated`,
`pkg_newsletter_user`.`signup_date` AS NewsletterAnmeldedatum,
AdrB.`company` AS RechAdr_Firma,
AdrBSalutation.`name` AS RechAdr_Anrede,
AdrB.`firstname` AS RechAdr_Vorname,
AdrB.`lastname` AS RechAdr_Nachname,
AdrB.`street` AS RechAdr_Strasse,
AdrB.`streetnr` AS RechAdr_Hausnummer,
AdrB.`city` AS RechAdr_Stadt,
AdrB.`postalcode` AS RechAdr_PLZ,
AdrB.`telefon` AS RechAdr_Telefon,
AdrB.`fax` AS RechAdr_Fax,
AdrBCountry.`name` AS RechAdr_Land,
AdrS.`company` AS LiefAdr_Firma,
AdrSSalutation.`name` AS LiefAdr_Anrede,
AdrS.`firstname` AS LiefAdr_Vorname,
AdrS.`lastname` AS LiefAdr_Nachname,
AdrS.`street` AS LiefAdr_Strasse,
AdrS.`streetnr` AS LiefAdr_Hausnummer,
AdrS.`city` AS LiefAdr_Stadt,
AdrS.`postalcode` AS LiefAdr_PLZ,
AdrS.`telefon` AS LiefAdr_Telefon,
AdrS.`fax` AS LiefAdr_Fax,
AdrSCountry.`name` AS LiefAdr_Land
FROM `data_extranet_user`
LEFT JOIN `data_extranet_user_address` AS AdrB ON (`data_extranet_user`.`default_billing_address_id` = AdrB.`id`)
LEFT JOIN `data_extranet_salutation` AS AdrBSalutation ON AdrB.`data_extranet_salutation_id` = AdrBSalutation.`id`
LEFT JOIN `data_country` AS AdrBCountry ON AdrB.`data_country_id` = AdrBCountry.`id`
LEFT JOIN `data_extranet_user_address` AS AdrS ON (`data_extranet_user`.`default_shipping_address_id` = AdrS.`id`)
LEFT JOIN `data_extranet_salutation` AS AdrSSalutation ON AdrB.`data_extranet_salutation_id` = AdrSSalutation.`id`
LEFT JOIN `data_country` AS AdrSCountry ON AdrS.`data_country_id` = AdrSCountry.`id`
LEFT JOIN `pkg_newsletter_user` ON (`data_extranet_user`.`id` = `pkg_newsletter_user`.`data_extranet_user_id`)
';
$oTCMSRecordList = new TCMSRecordList();
/** @var $oTCMSRecordList TCMSRecordList */
$oTCMSRecordList->sTableName = 'data_extranet_user';
$oTCMSRecordList->Load($query);
return $oTCMSRecordList;
} | [
"protected",
"function",
"GetDataList",
"(",
")",
"{",
"$",
"query",
"=",
"'SELECT `data_extranet_user`.`id` AS UserId,\n `data_extranet_user`.`name` AS EMail,\n `data_extranet_user`.`customer_number` AS KundenNr,\n `data_extranet_u... | OVERWRITE THIS TO FETCH THE DATA. MUST RETURN A TCMSRecordList.
@return TCMSRecordList | [
"OVERWRITE",
"THIS",
"TO",
"FETCH",
"THE",
"DATA",
".",
"MUST",
"RETURN",
"A",
"TCMSRecordList",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/TCMSInterface/TShopInterfaceExportCustomers.class.php#L19-L68 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetAllInputFieldParameter | protected function GetAllInputFieldParameter($aParameter = array())
{
if (!is_array($aParameter)) {
$aParameter = array();
}
$aParameter = $this->GetStandardInputFieldParameter($aParameter);
$aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ');
$aParameter['use_datastorage'] = $this->GetConfigParameter('use_datastorage');
$aParameter['datastorage_reuse_method'] = $this->GetConfigParameter('datastorage_reuse_method');
$sDataExpireDateSec = time() + ((int) $this->GetConfigParameter('expiretime_min')) * 60;
$aParameter['datastorage_expirydate'] = date('Y/m/d H:i:s', $sDataExpireDateSec);
$oGlobal = TGlobal::instance();
$aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName;
return $aParameter;
} | php | protected function GetAllInputFieldParameter($aParameter = array())
{
if (!is_array($aParameter)) {
$aParameter = array();
}
$aParameter = $this->GetStandardInputFieldParameter($aParameter);
$aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ');
$aParameter['use_datastorage'] = $this->GetConfigParameter('use_datastorage');
$aParameter['datastorage_reuse_method'] = $this->GetConfigParameter('datastorage_reuse_method');
$sDataExpireDateSec = time() + ((int) $this->GetConfigParameter('expiretime_min')) * 60;
$aParameter['datastorage_expirydate'] = date('Y/m/d H:i:s', $sDataExpireDateSec);
$oGlobal = TGlobal::instance();
$aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName;
return $aParameter;
} | [
"protected",
"function",
"GetAllInputFieldParameter",
"(",
"$",
"aParameter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aParameter",
")",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"}",
"$",
"aParameter",
"... | Get all needed parameter for first request to ipayment
Contain standat parameter and storage parameter.
@param array $aParameter
@return array $aParameter | [
"Get",
"all",
"needed",
"parameter",
"for",
"first",
"request",
"to",
"ipayment",
"Contain",
"standat",
"parameter",
"and",
"storage",
"parameter",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L111-L126 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetStandardInputFieldParameter | protected function GetStandardInputFieldParameter($aParameter = array())
{
if (!is_array($aParameter)) {
$aParameter = array();
}
$oShopBasket = TShopBasket::GetInstance();
$aParameter['ppcdccd'] = '51a492928930f294568ff'; // chameleon ipayment identifier
$aParameter['trxuser_id'] = $this->GetConfigParameter('trxuser_id');
$aParameter['trxpassword'] = $this->GetConfigParameter('transaction_password');
$aParameter['adminactionpassword'] = $this->GetConfigParameter('adminactionpassword');
$aParameter['silent'] = $this->GetConfigParameter('silent_mode');
$aParameter['advanced_strict_id_check'] = $this->GetConfigParameter('advanced_strict_id_check');
$aParameter['return_paymentdata_details'] = $this->GetConfigParameter('return_paymentdata_details');
$aParameter['shopper_id'] = $oShopBasket->sBasketIdentifier;
$aParameter['trx_amount'] = round($oShopBasket->dCostTotal * 100, 0);
$aParameter['trx_currency'] = $this->GetCurrencyIdentifier();
$sSecurityHash = $this->GenerateSecurityHash($aParameter);
if (!empty($sSecurityHash)) {
$aParameter['trx_securityhash'] = $sSecurityHash;
}
$oStep = $this->GetActiveOrderStep();
$redirectUrl = $this->GetExecutePaymentErrorURL($oStep->fieldSystemname);
$aParameter['redirect_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/success';
$aParameter['silent_error_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/error';
return $aParameter;
} | php | protected function GetStandardInputFieldParameter($aParameter = array())
{
if (!is_array($aParameter)) {
$aParameter = array();
}
$oShopBasket = TShopBasket::GetInstance();
$aParameter['ppcdccd'] = '51a492928930f294568ff'; // chameleon ipayment identifier
$aParameter['trxuser_id'] = $this->GetConfigParameter('trxuser_id');
$aParameter['trxpassword'] = $this->GetConfigParameter('transaction_password');
$aParameter['adminactionpassword'] = $this->GetConfigParameter('adminactionpassword');
$aParameter['silent'] = $this->GetConfigParameter('silent_mode');
$aParameter['advanced_strict_id_check'] = $this->GetConfigParameter('advanced_strict_id_check');
$aParameter['return_paymentdata_details'] = $this->GetConfigParameter('return_paymentdata_details');
$aParameter['shopper_id'] = $oShopBasket->sBasketIdentifier;
$aParameter['trx_amount'] = round($oShopBasket->dCostTotal * 100, 0);
$aParameter['trx_currency'] = $this->GetCurrencyIdentifier();
$sSecurityHash = $this->GenerateSecurityHash($aParameter);
if (!empty($sSecurityHash)) {
$aParameter['trx_securityhash'] = $sSecurityHash;
}
$oStep = $this->GetActiveOrderStep();
$redirectUrl = $this->GetExecutePaymentErrorURL($oStep->fieldSystemname);
$aParameter['redirect_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/success';
$aParameter['silent_error_url'] = $redirectUrl.'/'.self::URL_PARAMETER_NAME.'/error';
return $aParameter;
} | [
"protected",
"function",
"GetStandardInputFieldParameter",
"(",
"$",
"aParameter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aParameter",
")",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"}",
"$",
"oShopBasket... | Get standard parameters needed for all requests to Ipayment.
@param array $aParameter
@return array $aParameter | [
"Get",
"standard",
"parameters",
"needed",
"for",
"all",
"requests",
"to",
"Ipayment",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L135-L166 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GenerateSecurityHash | protected function GenerateSecurityHash($aParameter)
{
$trx_securityhash = '';
$sSharedSecret = $this->GetConfigParameter('shared_secret');
if (!empty($sSharedSecret)) {
$trx_securityhash = md5($aParameter['trxuser_id'].$aParameter['trx_amount'].$aParameter['trx_currency'].$aParameter['trxpassword'].$sSharedSecret);
}
return $trx_securityhash;
} | php | protected function GenerateSecurityHash($aParameter)
{
$trx_securityhash = '';
$sSharedSecret = $this->GetConfigParameter('shared_secret');
if (!empty($sSharedSecret)) {
$trx_securityhash = md5($aParameter['trxuser_id'].$aParameter['trx_amount'].$aParameter['trx_currency'].$aParameter['trxpassword'].$sSharedSecret);
}
return $trx_securityhash;
} | [
"protected",
"function",
"GenerateSecurityHash",
"(",
"$",
"aParameter",
")",
"{",
"$",
"trx_securityhash",
"=",
"''",
";",
"$",
"sSharedSecret",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'shared_secret'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$... | return the security hash for the input data.
@param $aParameter
@return string | [
"return",
"the",
"security",
"hash",
"for",
"the",
"input",
"data",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L175-L184 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetActiveOrderStep | protected function GetActiveOrderStep()
{
$oActiveOrderStep = null;
$oGlobal = TGlobal::instance();
$sActiveStepSysName = $oGlobal->GetUserData('stpsysname');
$oActiveOrderStep = TdbShopOrderStep::GetStep($sActiveStepSysName);
return $oActiveOrderStep;
} | php | protected function GetActiveOrderStep()
{
$oActiveOrderStep = null;
$oGlobal = TGlobal::instance();
$sActiveStepSysName = $oGlobal->GetUserData('stpsysname');
$oActiveOrderStep = TdbShopOrderStep::GetStep($sActiveStepSysName);
return $oActiveOrderStep;
} | [
"protected",
"function",
"GetActiveOrderStep",
"(",
")",
"{",
"$",
"oActiveOrderStep",
"=",
"null",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"sActiveStepSysName",
"=",
"$",
"oGlobal",
"->",
"GetUserData",
"(",
"'stpsysname'",
... | Get the active oder step neede for redirect url.
@return TdbShopOrderStep $oActiveOrderStep | [
"Get",
"the",
"active",
"oder",
"step",
"neede",
"for",
"redirect",
"url",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L213-L221 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetPayFieldParameter | protected function GetPayFieldParameter($aParameter = array(), $oOrder)
{
if (!is_array($aParameter)) {
$aParameter = array();
}
$aParameter = $this->GetStandardInputFieldParameter($aParameter);
if (!empty($this->sStorageId)) {
$aParameter['from_datastorage_id'] = $this->sStorageId;
}
$oShopBasket = TShopBasket::GetInstance();
$oActivePaymentMethod = $oShopBasket->GetActivePaymentMethod();
$aParameter['shop_payment_method_id'] = $oActivePaymentMethod->id;
$redirectUrl = $this->GetRedirectUrl();
$sSilentErrorURL = $this->GetExecutePaymentErrorURL();
if ($sSilentErrorURL) {
$aParameter['silent_error_url'] = $sSilentErrorURL.'/'.self::URL_PARAMETER_NAME.'/error';
}
$aParameter['redirect_url'] = $redirectUrl;
$oIPNManager = new TPkgShopPaymentIPNManager();
$oPortal = $this->getPortalDomainService()->getActivePortal();
$aParameter['hidden_trigger_url'] = $oIPNManager->getIPNURL($oPortal, $oOrder);
$aParameter['expire_datastorage'] = true;
$aParameter['execute_order'] = true;
$oGlobal = TGlobal::instance();
$aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ_pay');
return $aParameter;
} | php | protected function GetPayFieldParameter($aParameter = array(), $oOrder)
{
if (!is_array($aParameter)) {
$aParameter = array();
}
$aParameter = $this->GetStandardInputFieldParameter($aParameter);
if (!empty($this->sStorageId)) {
$aParameter['from_datastorage_id'] = $this->sStorageId;
}
$oShopBasket = TShopBasket::GetInstance();
$oActivePaymentMethod = $oShopBasket->GetActivePaymentMethod();
$aParameter['shop_payment_method_id'] = $oActivePaymentMethod->id;
$redirectUrl = $this->GetRedirectUrl();
$sSilentErrorURL = $this->GetExecutePaymentErrorURL();
if ($sSilentErrorURL) {
$aParameter['silent_error_url'] = $sSilentErrorURL.'/'.self::URL_PARAMETER_NAME.'/error';
}
$aParameter['redirect_url'] = $redirectUrl;
$oIPNManager = new TPkgShopPaymentIPNManager();
$oPortal = $this->getPortalDomainService()->getActivePortal();
$aParameter['hidden_trigger_url'] = $oIPNManager->getIPNURL($oPortal, $oOrder);
$aParameter['expire_datastorage'] = true;
$aParameter['execute_order'] = true;
$oGlobal = TGlobal::instance();
$aParameter['spot'] = $oGlobal->GetExecutingModulePointer()->sModuleSpotName;
$aParameter['trx_typ'] = $this->GetConfigParameter('trx_typ_pay');
return $aParameter;
} | [
"protected",
"function",
"GetPayFieldParameter",
"(",
"$",
"aParameter",
"=",
"array",
"(",
")",
",",
"$",
"oOrder",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"aParameter",
")",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"}",
"$"... | Get parameter to pay a transaction on IPayment with saved storage id.
@param array $aParameter
@return array $aParameter | [
"Get",
"parameter",
"to",
"pay",
"a",
"transaction",
"on",
"IPayment",
"with",
"saved",
"storage",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L230-L258 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetBillingCountryISOCode | protected function GetBillingCountryISOCode($oBillingAddress)
{
$sIsoCode = '';
$oCountry = $oBillingAddress->GetFieldDataCountry();
if (!is_null($oCountry)) {
$oSystemCountry = $oCountry->GetFieldTCountry();
if (!is_null($oSystemCountry)) {
$sIsoCode = $oSystemCountry->fieldIsoCode2;
}
}
return $sIsoCode;
} | php | protected function GetBillingCountryISOCode($oBillingAddress)
{
$sIsoCode = '';
$oCountry = $oBillingAddress->GetFieldDataCountry();
if (!is_null($oCountry)) {
$oSystemCountry = $oCountry->GetFieldTCountry();
if (!is_null($oSystemCountry)) {
$sIsoCode = $oSystemCountry->fieldIsoCode2;
}
}
return $sIsoCode;
} | [
"protected",
"function",
"GetBillingCountryISOCode",
"(",
"$",
"oBillingAddress",
")",
"{",
"$",
"sIsoCode",
"=",
"''",
";",
"$",
"oCountry",
"=",
"$",
"oBillingAddress",
"->",
"GetFieldDataCountry",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oCoun... | Get the iso code from users billing address.
@param TdbDataExtranetUserAddress $oBillingAddress
@return string $sIsoCode | [
"Get",
"the",
"iso",
"code",
"from",
"users",
"billing",
"address",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L314-L326 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetRequestURL | protected function GetRequestURL()
{
$sAccountId = $this->GetConfigParameter('account_id');
$sRequestUrl = $this->GetConfigParameter('request_url');
$sRequestUrl = str_replace('[{sAccountId}]', $sAccountId, $sRequestUrl);
return $sRequestUrl;
} | php | protected function GetRequestURL()
{
$sAccountId = $this->GetConfigParameter('account_id');
$sRequestUrl = $this->GetConfigParameter('request_url');
$sRequestUrl = str_replace('[{sAccountId}]', $sAccountId, $sRequestUrl);
return $sRequestUrl;
} | [
"protected",
"function",
"GetRequestURL",
"(",
")",
"{",
"$",
"sAccountId",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'account_id'",
")",
";",
"$",
"sRequestUrl",
"=",
"$",
"this",
"->",
"GetConfigParameter",
"(",
"'request_url'",
")",
";",
"$",
"s... | Get the ipayment request url with replaced account id.
@return string $sRequestUrl | [
"Get",
"the",
"ipayment",
"request",
"url",
"with",
"replaced",
"account",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L333-L340 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetErrorCodesFromResponse | protected function GetErrorCodesFromResponse()
{
$SReturnMessage = false;
if ($this->bIsCorrectIPaymentType()) {
$oGlobal = TGlobal::instance();
$SReturnState = $oGlobal->GetUserData('ret_status');
if ('ERROR' == $SReturnState) {
$SReturnMessage = $oGlobal->GetUserData('ret_errormsg');
$SReturnMessage = utf8_encode($SReturnMessage);
}
}
return $SReturnMessage;
} | php | protected function GetErrorCodesFromResponse()
{
$SReturnMessage = false;
if ($this->bIsCorrectIPaymentType()) {
$oGlobal = TGlobal::instance();
$SReturnState = $oGlobal->GetUserData('ret_status');
if ('ERROR' == $SReturnState) {
$SReturnMessage = $oGlobal->GetUserData('ret_errormsg');
$SReturnMessage = utf8_encode($SReturnMessage);
}
}
return $SReturnMessage;
} | [
"protected",
"function",
"GetErrorCodesFromResponse",
"(",
")",
"{",
"$",
"SReturnMessage",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"bIsCorrectIPaymentType",
"(",
")",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",... | Get error message sent by IPayment to cms.
@return string $SReturnMessage | [
"Get",
"error",
"message",
"sent",
"by",
"IPayment",
"to",
"cms",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L403-L416 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.PostProcessExternalPaymentHandlerHook | public function PostProcessExternalPaymentHandlerHook()
{
$bPaymentTransmitOk = parent::PostProcessExternalPaymentHandlerHook();
if ($bPaymentTransmitOk) {
$oGlobal = TGlobal::instance();
$sStatus = $oGlobal->GetUserData('ret_status');
if ('ERROR' == $sStatus) {
$this->SetErrorCodesFromResponseToMessageManager();
$bPaymentTransmitOk = false;
}
$this->sStorageId = $oGlobal->GetUserData('storage_id');
$this->aPaymentUserData = $oGlobal->GetUserData();
// the data from ipayment is not returned as iso-8859
foreach (array_keys($this->aPaymentUserData) as $sKey) {
if (!is_array($this->aPaymentUserData[$sKey])) {
$this->aPaymentUserData[$sKey] = utf8_encode($this->aPaymentUserData[$sKey]);
}
}
$this->aPaymentUserData['sStorageId'] = $this->sStorageId;
}
if (true === $bPaymentTransmitOk) {
$aSecuritiyCheckPostParameter = $this->GetNeedeResponsePostParameterForSecurityCheck();
$bPaymentTransmitOk = $this->IsSecurityCheckOk($aSecuritiyCheckPostParameter['trxuser_id'], $aSecuritiyCheckPostParameter['trx_amount'], $aSecuritiyCheckPostParameter['trx_currency'], $aSecuritiyCheckPostParameter['ret_authcode'], $aSecuritiyCheckPostParameter['ret_trx_number'], $aSecuritiyCheckPostParameter['ret_param_checksum']);
if (false === $bPaymentTransmitOk) {
// security error - unable to validate hash
TTools::WriteLogEntry('iPayment Error: unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration', 1, __FILE__, __LINE__);
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage(TShopPaymentHandlerIPaymentCreditCard::MSG_MANAGER_NAME, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration'));
}
}
return $bPaymentTransmitOk;
} | php | public function PostProcessExternalPaymentHandlerHook()
{
$bPaymentTransmitOk = parent::PostProcessExternalPaymentHandlerHook();
if ($bPaymentTransmitOk) {
$oGlobal = TGlobal::instance();
$sStatus = $oGlobal->GetUserData('ret_status');
if ('ERROR' == $sStatus) {
$this->SetErrorCodesFromResponseToMessageManager();
$bPaymentTransmitOk = false;
}
$this->sStorageId = $oGlobal->GetUserData('storage_id');
$this->aPaymentUserData = $oGlobal->GetUserData();
// the data from ipayment is not returned as iso-8859
foreach (array_keys($this->aPaymentUserData) as $sKey) {
if (!is_array($this->aPaymentUserData[$sKey])) {
$this->aPaymentUserData[$sKey] = utf8_encode($this->aPaymentUserData[$sKey]);
}
}
$this->aPaymentUserData['sStorageId'] = $this->sStorageId;
}
if (true === $bPaymentTransmitOk) {
$aSecuritiyCheckPostParameter = $this->GetNeedeResponsePostParameterForSecurityCheck();
$bPaymentTransmitOk = $this->IsSecurityCheckOk($aSecuritiyCheckPostParameter['trxuser_id'], $aSecuritiyCheckPostParameter['trx_amount'], $aSecuritiyCheckPostParameter['trx_currency'], $aSecuritiyCheckPostParameter['ret_authcode'], $aSecuritiyCheckPostParameter['ret_trx_number'], $aSecuritiyCheckPostParameter['ret_param_checksum']);
if (false === $bPaymentTransmitOk) {
// security error - unable to validate hash
TTools::WriteLogEntry('iPayment Error: unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration', 1, __FILE__, __LINE__);
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage(TShopPaymentHandlerIPaymentCreditCard::MSG_MANAGER_NAME, 'ERROR-ORDER-REQUEST-PAYMENT-ERROR', array('errorMsg' => 'unable to validate security hash. Either the Request is manipulated, or the "Transaktions-Security-Key" was not set in the ipayment configuration'));
}
}
return $bPaymentTransmitOk;
} | [
"public",
"function",
"PostProcessExternalPaymentHandlerHook",
"(",
")",
"{",
"$",
"bPaymentTransmitOk",
"=",
"parent",
"::",
"PostProcessExternalPaymentHandlerHook",
"(",
")",
";",
"if",
"(",
"$",
"bPaymentTransmitOk",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::"... | Save storage id sent from IPayment and make security check
the method is called when an external payment handler returns successfully. | [
"Save",
"storage",
"id",
"sent",
"from",
"IPayment",
"and",
"make",
"security",
"check",
"the",
"method",
"is",
"called",
"when",
"an",
"external",
"payment",
"handler",
"returns",
"successfully",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L422-L455 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.ExecuteIPaymentCall | protected function ExecuteIPaymentCall($oOrder)
{
$parameters = $this->GetPayFieldParameter(array(), $oOrder);
$requestUrl = $this->GetRequestURL();
$url = $requestUrl.$this->getUrlUtil()->getArrayAsUrl($parameters, '?', '&');
$this->getRedirect()->redirect($url);
} | php | protected function ExecuteIPaymentCall($oOrder)
{
$parameters = $this->GetPayFieldParameter(array(), $oOrder);
$requestUrl = $this->GetRequestURL();
$url = $requestUrl.$this->getUrlUtil()->getArrayAsUrl($parameters, '?', '&');
$this->getRedirect()->redirect($url);
} | [
"protected",
"function",
"ExecuteIPaymentCall",
"(",
"$",
"oOrder",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"GetPayFieldParameter",
"(",
"array",
"(",
")",
",",
"$",
"oOrder",
")",
";",
"$",
"requestUrl",
"=",
"$",
"this",
"->",
"GetRequestURL... | Send payment call to IPayment and check if payment was successfully done. | [
"Send",
"payment",
"call",
"to",
"IPayment",
"and",
"check",
"if",
"payment",
"was",
"successfully",
"done",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L520-L526 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.IsSuccessResponse | protected function IsSuccessResponse($response = '')
{
$bPaymentOk = false;
$oGlobal = TGlobal::instance();
if (empty($response)) {
$aResult = $this->GetNeedeResponsePostParameterForSecurityCheck();
$aResult['ret_status'] = $oGlobal->GetUserData('ret_status');
} else {
$aResult = $this->GetResultFormResponse($response);
}
if (count($aResult) > 0 && array_key_exists('ret_status', $aResult) && 'SUCCESS' == $aResult['ret_status']) {
$bPaymentOk = true;
}
if ($bPaymentOk) {
$bPaymentOk = $this->IsSecurityCheckOk($aResult['trxuser_id'], $aResult['trx_amount'], $aResult['trx_currency'], $aResult['ret_authcode'], $aResult['ret_trx_number'], $aResult['ret_param_checksum']);
}
return $bPaymentOk;
} | php | protected function IsSuccessResponse($response = '')
{
$bPaymentOk = false;
$oGlobal = TGlobal::instance();
if (empty($response)) {
$aResult = $this->GetNeedeResponsePostParameterForSecurityCheck();
$aResult['ret_status'] = $oGlobal->GetUserData('ret_status');
} else {
$aResult = $this->GetResultFormResponse($response);
}
if (count($aResult) > 0 && array_key_exists('ret_status', $aResult) && 'SUCCESS' == $aResult['ret_status']) {
$bPaymentOk = true;
}
if ($bPaymentOk) {
$bPaymentOk = $this->IsSecurityCheckOk($aResult['trxuser_id'], $aResult['trx_amount'], $aResult['trx_currency'], $aResult['ret_authcode'], $aResult['ret_trx_number'], $aResult['ret_param_checksum']);
}
return $bPaymentOk;
} | [
"protected",
"function",
"IsSuccessResponse",
"(",
"$",
"response",
"=",
"''",
")",
"{",
"$",
"bPaymentOk",
"=",
"false",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"response",
")",
")",
"{",
"... | Check if the payment call to IPayment was succesfully done
by parameter ret_status and hash check.
deprecated
@param string $response if empty function get parameter from post
@return bool $bPaymentOk | [
"Check",
"if",
"the",
"payment",
"call",
"to",
"IPayment",
"was",
"succesfully",
"done",
"by",
"parameter",
"ret_status",
"and",
"hash",
"check",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L538-L557 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.IsSecurityCheckOk | protected function IsSecurityCheckOk($trxuser_id, $trx_amount, $trx_currency, $trxpassword, $ret_trx_number, $sOldChecksum)
{
$bChecksumIsOk = true;
$sSharedSecret = $this->GetConfigParameter('shared_secret');
if (!empty($sSharedSecret)) {
$sNewChecksum = md5($trxuser_id.$trx_amount.$trx_currency.$trxpassword.$ret_trx_number.$sSharedSecret);
if ($sNewChecksum != $sOldChecksum) {
$bChecksumIsOk = false;
}
}
return $bChecksumIsOk;
} | php | protected function IsSecurityCheckOk($trxuser_id, $trx_amount, $trx_currency, $trxpassword, $ret_trx_number, $sOldChecksum)
{
$bChecksumIsOk = true;
$sSharedSecret = $this->GetConfigParameter('shared_secret');
if (!empty($sSharedSecret)) {
$sNewChecksum = md5($trxuser_id.$trx_amount.$trx_currency.$trxpassword.$ret_trx_number.$sSharedSecret);
if ($sNewChecksum != $sOldChecksum) {
$bChecksumIsOk = false;
}
}
return $bChecksumIsOk;
} | [
"protected",
"function",
"IsSecurityCheckOk",
"(",
"$",
"trxuser_id",
",",
"$",
"trx_amount",
",",
"$",
"trx_currency",
",",
"$",
"trxpassword",
",",
"$",
"ret_trx_number",
",",
"$",
"sOldChecksum",
")",
"{",
"$",
"bChecksumIsOk",
"=",
"true",
";",
"$",
"sSh... | make md5 check over security parameter with shared secret and chek resutl with
hash from IPayment.
@param string $trxuser_id
@param string $trx_amount
@param string $trx_currency
@param string $trxpassword
@param string $ret_trx_number
@param string $sOldChecksum
@return bool $bChecksumIsOk | [
"make",
"md5",
"check",
"over",
"security",
"parameter",
"with",
"shared",
"secret",
"and",
"chek",
"resutl",
"with",
"hash",
"from",
"IPayment",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L572-L584 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetResultFormResponse | protected function GetResultFormResponse($response)
{
$aNeededResponseParameterToCheck = array('ret_status' => '', 'ret_errormsg' => '', 'trxuser_id' => '', 'trx_amount' => '', 'trx_currency' => '', 'ret_authcode' => '', 'ret_trx_number' => '', 'ret_param_checksum' => '');
preg_match('/<a href=".*'.self::URL_PARAMETER_NAME.'\\/(success|error)\?(.*)">/', $response, $aMatch);
if (count($aMatch) > 2) {
$aResponseParts = explode('&', $aMatch[2]);
foreach ($aResponseParts as $sRepsponsePart) {
$aResponseKeyValue = explode('=', $sRepsponsePart);
if (2 == count($aResponseKeyValue) && array_key_exists($aResponseKeyValue[0], $aNeededResponseParameterToCheck)) {
$aNeededResponseParameterToCheck[$aResponseKeyValue[0]] = $aResponseKeyValue[1];
}
}
}
return $aNeededResponseParameterToCheck;
} | php | protected function GetResultFormResponse($response)
{
$aNeededResponseParameterToCheck = array('ret_status' => '', 'ret_errormsg' => '', 'trxuser_id' => '', 'trx_amount' => '', 'trx_currency' => '', 'ret_authcode' => '', 'ret_trx_number' => '', 'ret_param_checksum' => '');
preg_match('/<a href=".*'.self::URL_PARAMETER_NAME.'\\/(success|error)\?(.*)">/', $response, $aMatch);
if (count($aMatch) > 2) {
$aResponseParts = explode('&', $aMatch[2]);
foreach ($aResponseParts as $sRepsponsePart) {
$aResponseKeyValue = explode('=', $sRepsponsePart);
if (2 == count($aResponseKeyValue) && array_key_exists($aResponseKeyValue[0], $aNeededResponseParameterToCheck)) {
$aNeededResponseParameterToCheck[$aResponseKeyValue[0]] = $aResponseKeyValue[1];
}
}
}
return $aNeededResponseParameterToCheck;
} | [
"protected",
"function",
"GetResultFormResponse",
"(",
"$",
"response",
")",
"{",
"$",
"aNeededResponseParameterToCheck",
"=",
"array",
"(",
"'ret_status'",
"=>",
"''",
",",
"'ret_errormsg'",
"=>",
"''",
",",
"'trxuser_id'",
"=>",
"''",
",",
"'trx_amount'",
"=>",
... | Get parameter from IPayment response which are needed to check if payment request was successful.
@param string $response
@return array $aNeededResponseParameterToCheck | [
"Get",
"parameter",
"from",
"IPayment",
"response",
"which",
"are",
"needed",
"to",
"check",
"if",
"payment",
"request",
"was",
"successful",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L593-L608 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.GetNeedeResponsePostParameterForSecurityCheck | protected function GetNeedeResponsePostParameterForSecurityCheck()
{
$aParameter = array();
$oGlobal = TGlobal::instance();
$aParameter['trxuser_id'] = $oGlobal->GetUserData('trxuser_id');
$aParameter['trx_amount'] = $oGlobal->GetUserData('trx_amount');
$aParameter['trx_currency'] = $oGlobal->GetUserData('trx_currency');
$aParameter['ret_authcode'] = $oGlobal->GetUserData('ret_authcode');
$aParameter['ret_trx_number'] = $oGlobal->GetUserData('ret_trx_number');
$aParameter['ret_param_checksum'] = $oGlobal->GetUserData('ret_param_checksum');
return $aParameter;
} | php | protected function GetNeedeResponsePostParameterForSecurityCheck()
{
$aParameter = array();
$oGlobal = TGlobal::instance();
$aParameter['trxuser_id'] = $oGlobal->GetUserData('trxuser_id');
$aParameter['trx_amount'] = $oGlobal->GetUserData('trx_amount');
$aParameter['trx_currency'] = $oGlobal->GetUserData('trx_currency');
$aParameter['ret_authcode'] = $oGlobal->GetUserData('ret_authcode');
$aParameter['ret_trx_number'] = $oGlobal->GetUserData('ret_trx_number');
$aParameter['ret_param_checksum'] = $oGlobal->GetUserData('ret_param_checksum');
return $aParameter;
} | [
"protected",
"function",
"GetNeedeResponsePostParameterForSecurityCheck",
"(",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"$",
"aParameter",
"[",
"'trxuser_id'",
"]",
"=",
"$",
"... | Get response parameter from IPayment which are needed to make a security hash check.
@return array $aParameter | [
"Get",
"response",
"parameter",
"from",
"IPayment",
"which",
"are",
"needed",
"to",
"make",
"a",
"security",
"hash",
"check",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L615-L627 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php | TShopPaymentHandlerIPaymentEndPoint.bIsCorrectIPaymentType | protected function bIsCorrectIPaymentType()
{
$bIsCorrectIPaymentType = false;
$aParameter = $this->GetPaymentTypeSpecifivParameter();
$oGlobal = TGlobal::instance();
$sResponsePaymentType = $oGlobal->GetUserData('trx_paymenttyp');
if (!empty($sResponsePaymentType) && array_key_exists('trx_paymenttyp', $aParameter) && $aParameter['trx_paymenttyp'] == $sResponsePaymentType) {
$bIsCorrectIPaymentType = true;
}
return $bIsCorrectIPaymentType;
} | php | protected function bIsCorrectIPaymentType()
{
$bIsCorrectIPaymentType = false;
$aParameter = $this->GetPaymentTypeSpecifivParameter();
$oGlobal = TGlobal::instance();
$sResponsePaymentType = $oGlobal->GetUserData('trx_paymenttyp');
if (!empty($sResponsePaymentType) && array_key_exists('trx_paymenttyp', $aParameter) && $aParameter['trx_paymenttyp'] == $sResponsePaymentType) {
$bIsCorrectIPaymentType = true;
}
return $bIsCorrectIPaymentType;
} | [
"protected",
"function",
"bIsCorrectIPaymentType",
"(",
")",
"{",
"$",
"bIsCorrectIPaymentType",
"=",
"false",
";",
"$",
"aParameter",
"=",
"$",
"this",
"->",
"GetPaymentTypeSpecifivParameter",
"(",
")",
";",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"("... | Check after response from IPayment if the paymenthandler is the one which sent request to IPayment.
@return bool $bIsCorrectIPaymentType | [
"Check",
"after",
"response",
"from",
"IPayment",
"if",
"the",
"paymenthandler",
"is",
"the",
"one",
"which",
"sent",
"request",
"to",
"IPayment",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerIPaymentEndPoint.class.php#L634-L645 | train |
sylingd/Yesf | src/Event/Listener.php | Listener.on | public function on($event, $callback) {
if (!is_callable($callback)) {
throw new ListenException(var_export($callback, true) . " is not callback");
}
$this->callback[$event] = $callback;
} | php | public function on($event, $callback) {
if (!is_callable($callback)) {
throw new ListenException(var_export($callback, true) . " is not callback");
}
$this->callback[$event] = $callback;
} | [
"public",
"function",
"on",
"(",
"$",
"event",
",",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"ListenException",
"(",
"var_export",
"(",
"$",
"callback",
",",
"true",
")",
".",
"\" ... | Set event handler
@access public
@param string $event
@param callable $callback | [
"Set",
"event",
"handler"
] | 0fc2b42903bb3519c54c596270c890c826aeb1df | https://github.com/sylingd/Yesf/blob/0fc2b42903bb3519c54c596270c890c826aeb1df/src/Event/Listener.php#L190-L195 | train |
edmondscommerce/doctrine-static-meta | src/Entity/Embeddable/Objects/AbstractEmbeddableObject.php | AbstractEmbeddableObject.notifyEmbeddablePrefixedProperties | protected function notifyEmbeddablePrefixedProperties(
?string $propName = null,
$oldValue = null,
$newValue = null
): void {
if (null === $this->owningEntity) {
return;
}
$this->owningEntity->notifyEmbeddablePrefixedProperties(
$this->getPrefix(),
$propName,
$oldValue,
$newValue
);
} | php | protected function notifyEmbeddablePrefixedProperties(
?string $propName = null,
$oldValue = null,
$newValue = null
): void {
if (null === $this->owningEntity) {
return;
}
$this->owningEntity->notifyEmbeddablePrefixedProperties(
$this->getPrefix(),
$propName,
$oldValue,
$newValue
);
} | [
"protected",
"function",
"notifyEmbeddablePrefixedProperties",
"(",
"?",
"string",
"$",
"propName",
"=",
"null",
",",
"$",
"oldValue",
"=",
"null",
",",
"$",
"newValue",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"ow... | If we are attached to an owning Entity, then we need to use it to Notify the Unit of Work about changes
If we are not attached, then do nothing. When we are attached, this should be triggered automatically
@param null|string $propName
@param null|mixed $oldValue
@param null|mixed $newValue | [
"If",
"we",
"are",
"attached",
"to",
"an",
"owning",
"Entity",
"then",
"we",
"need",
"to",
"use",
"it",
"to",
"Notify",
"the",
"Unit",
"of",
"Work",
"about",
"changes"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/src/Entity/Embeddable/Objects/AbstractEmbeddableObject.php#L41-L55 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.GetNumberOfArticlesInCategory | public function GetNumberOfArticlesInCategory($bIncludeSubcategoriesInCount = false)
{
if ($bIncludeSubcategoriesInCount) {
$oArticleList = $this->GetArticleListIncludingSubcategories();
} else {
$oArticleList = $this->GetArticleList();
}
return $oArticleList->Length();
} | php | public function GetNumberOfArticlesInCategory($bIncludeSubcategoriesInCount = false)
{
if ($bIncludeSubcategoriesInCount) {
$oArticleList = $this->GetArticleListIncludingSubcategories();
} else {
$oArticleList = $this->GetArticleList();
}
return $oArticleList->Length();
} | [
"public",
"function",
"GetNumberOfArticlesInCategory",
"(",
"$",
"bIncludeSubcategoriesInCount",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"bIncludeSubcategoriesInCount",
")",
"{",
"$",
"oArticleList",
"=",
"$",
"this",
"->",
"GetArticleListIncludingSubcategories",
"(",
... | returns a count of the number of articles in the category. the method caches
the data since a count is expensive.
@param bool $bIncludeSubcategoriesInCount
@return int | [
"returns",
"a",
"count",
"of",
"the",
"number",
"of",
"articles",
"in",
"the",
"category",
".",
"the",
"method",
"caches",
"the",
"data",
"since",
"a",
"count",
"is",
"expensive",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L162-L171 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.& | public function &GetParent()
{
$oParent = null;
if (!empty($this->fieldShopCategoryId)) {
$oParent = TdbShopCategory::GetNewInstance();
$oParent->SetLanguage($this->iLanguageId);
if (!$oParent->Load($this->fieldShopCategoryId)) {
$oParent = null;
}
}
return $oParent;
} | php | public function &GetParent()
{
$oParent = null;
if (!empty($this->fieldShopCategoryId)) {
$oParent = TdbShopCategory::GetNewInstance();
$oParent->SetLanguage($this->iLanguageId);
if (!$oParent->Load($this->fieldShopCategoryId)) {
$oParent = null;
}
}
return $oParent;
} | [
"public",
"function",
"&",
"GetParent",
"(",
")",
"{",
"$",
"oParent",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"fieldShopCategoryId",
")",
")",
"{",
"$",
"oParent",
"=",
"TdbShopCategory",
"::",
"GetNewInstance",
"(",
")",
";... | return the parent category, or null if no parent is found.
@return TdbShopCategory | [
"return",
"the",
"parent",
"category",
"or",
"null",
"if",
"no",
"parent",
"is",
"found",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L226-L238 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.IsInCategoryPath | public function IsInCategoryPath($sCategoryId)
{
$oBreadCrumb = $this->GetBreadcrumb();
$oMatchingNode = $oBreadCrumb->FindItemWithProperty('id', $sCategoryId);
if ($oMatchingNode) {
return true;
} else {
return false;
}
} | php | public function IsInCategoryPath($sCategoryId)
{
$oBreadCrumb = $this->GetBreadcrumb();
$oMatchingNode = $oBreadCrumb->FindItemWithProperty('id', $sCategoryId);
if ($oMatchingNode) {
return true;
} else {
return false;
}
} | [
"public",
"function",
"IsInCategoryPath",
"(",
"$",
"sCategoryId",
")",
"{",
"$",
"oBreadCrumb",
"=",
"$",
"this",
"->",
"GetBreadcrumb",
"(",
")",
";",
"$",
"oMatchingNode",
"=",
"$",
"oBreadCrumb",
"->",
"FindItemWithProperty",
"(",
"'id'",
",",
"$",
"sCat... | return true if the category id passed is in the path to this category.
@param string $sCategoryId
@return bool | [
"return",
"true",
"if",
"the",
"category",
"id",
"passed",
"is",
"in",
"the",
"path",
"to",
"this",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L267-L276 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.GetCategoryPathAsString | public function GetCategoryPathAsString($sSeparator = '/')
{
$sKey = 'sCatPathCache'.$sSeparator;
$sPath = $this->GetFromInternalCache($sKey);
if (is_null($sPath)) {
$sPath = '';
$oParent = &$this->GetParent();
if ($oParent) {
$sPath = $oParent->GetCategoryPathAsString($sSeparator);
}
if (!empty($sPath)) {
$sPath .= $sSeparator;
}
$sPath .= $this->GetName();
$this->SetInternalCache($sKey, $sPath);
}
return $sPath;
} | php | public function GetCategoryPathAsString($sSeparator = '/')
{
$sKey = 'sCatPathCache'.$sSeparator;
$sPath = $this->GetFromInternalCache($sKey);
if (is_null($sPath)) {
$sPath = '';
$oParent = &$this->GetParent();
if ($oParent) {
$sPath = $oParent->GetCategoryPathAsString($sSeparator);
}
if (!empty($sPath)) {
$sPath .= $sSeparator;
}
$sPath .= $this->GetName();
$this->SetInternalCache($sKey, $sPath);
}
return $sPath;
} | [
"public",
"function",
"GetCategoryPathAsString",
"(",
"$",
"sSeparator",
"=",
"'/'",
")",
"{",
"$",
"sKey",
"=",
"'sCatPathCache'",
".",
"$",
"sSeparator",
";",
"$",
"sPath",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"$",
"sKey",
")",
";",
"if",... | return the category path as a string, each node separated by the sSeparator.
@param string $sSeparator
@return string | [
"return",
"the",
"category",
"path",
"as",
"a",
"string",
"each",
"node",
"separated",
"by",
"the",
"sSeparator",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L285-L304 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.& | public function &GetRootCategory()
{
$oRootCategory = &$this->GetFromInternalCache('oRootCategory');
if (is_null($oRootCategory)) {
$oRootCategory = clone $this;
while (!empty($oRootCategory->fieldShopCategoryId)) {
$oRootCategory = &$oRootCategory->GetParent();
}
$this->SetInternalCache('oRootCategory', $oRootCategory);
}
return $oRootCategory;
} | php | public function &GetRootCategory()
{
$oRootCategory = &$this->GetFromInternalCache('oRootCategory');
if (is_null($oRootCategory)) {
$oRootCategory = clone $this;
while (!empty($oRootCategory->fieldShopCategoryId)) {
$oRootCategory = &$oRootCategory->GetParent();
}
$this->SetInternalCache('oRootCategory', $oRootCategory);
}
return $oRootCategory;
} | [
"public",
"function",
"&",
"GetRootCategory",
"(",
")",
"{",
"$",
"oRootCategory",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oRootCategory'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oRootCategory",
")",
")",
"{",
"$",
"oRootCategory",
... | return the currents category root category.
@return TdbShopCategory | [
"return",
"the",
"currents",
"category",
"root",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L311-L323 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.& | public function &GetBreadcrumb()
{
$oBreadCrumb = &$this->GetFromInternalCache('oCategoryBreadcrumb');
if (is_null($oBreadCrumb)) {
$oBreadCrumb = &TdbShopCategoryList::GetCategoryPath($this->id, null, $this->GetLanguage());
$this->SetInternalCache('oCategoryBreadcrumb', $oBreadCrumb);
} else {
$oBreadCrumb->GoToStart();
}
return $oBreadCrumb;
} | php | public function &GetBreadcrumb()
{
$oBreadCrumb = &$this->GetFromInternalCache('oCategoryBreadcrumb');
if (is_null($oBreadCrumb)) {
$oBreadCrumb = &TdbShopCategoryList::GetCategoryPath($this->id, null, $this->GetLanguage());
$this->SetInternalCache('oCategoryBreadcrumb', $oBreadCrumb);
} else {
$oBreadCrumb->GoToStart();
}
return $oBreadCrumb;
} | [
"public",
"function",
"&",
"GetBreadcrumb",
"(",
")",
"{",
"$",
"oBreadCrumb",
"=",
"&",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oCategoryBreadcrumb'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oBreadCrumb",
")",
")",
"{",
"$",
"oBreadCrumb",
"=... | return a list of all categories to the current category.
@return TIterator | [
"return",
"a",
"list",
"of",
"all",
"categories",
"to",
"the",
"current",
"category",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L330-L341 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.AllowDisplayInShop | public function AllowDisplayInShop()
{
$bShowCat = false;
$oShop = TdbShop::GetInstance();
if (!is_null($oShop) && !$oShop->fieldShowEmptyCategories) {
$bShowCat = ($this->GetNumberOfArticlesInCategory(true) > 0);
} else {
$bShowCat = true;
}
if (false == $this->fieldActive || false == $this->fieldTreeActive) {
$bShowCat = false;
}
$targetPage = $this->getTargetPage();
if (null === $targetPage || false === $targetPage) {
return true;
}
// show only if the user has access to the category target page
if (false === $targetPage->AllowAccessByCurrentUser()) {
return false;
}
return $bShowCat;
} | php | public function AllowDisplayInShop()
{
$bShowCat = false;
$oShop = TdbShop::GetInstance();
if (!is_null($oShop) && !$oShop->fieldShowEmptyCategories) {
$bShowCat = ($this->GetNumberOfArticlesInCategory(true) > 0);
} else {
$bShowCat = true;
}
if (false == $this->fieldActive || false == $this->fieldTreeActive) {
$bShowCat = false;
}
$targetPage = $this->getTargetPage();
if (null === $targetPage || false === $targetPage) {
return true;
}
// show only if the user has access to the category target page
if (false === $targetPage->AllowAccessByCurrentUser()) {
return false;
}
return $bShowCat;
} | [
"public",
"function",
"AllowDisplayInShop",
"(",
")",
"{",
"$",
"bShowCat",
"=",
"false",
";",
"$",
"oShop",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"oShop",
")",
"&&",
"!",
"$",
"oShop",
"->",
"fieldS... | Hook for implementing category display logic.
@return bool | [
"Hook",
"for",
"implementing",
"category",
"display",
"logic",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L435-L460 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.GetSeoPattern | public function GetSeoPattern(&$sPaternIn)
{
//$sPaternIn = "[{PORTAL_NAME}] - [{CATEGORY_NAME}]"; //default
$aPatRepl = null;
if (!empty($this->sqlData['seo_pattern'])) {
$sPaternIn = $this->sqlData['seo_pattern'];
}
$aPatRepl = array();
$activePage = $this->getActivePageService()->getActivePage();
$aPatRepl['PORTAL_NAME'] = $activePage->GetPortal()->GetTitle();
$aPatRepl['PAGE_NAME'] = $activePage->GetName();
$aPatRepl['CATEGORY_NAME'] = $this->GetName();
return $aPatRepl;
} | php | public function GetSeoPattern(&$sPaternIn)
{
//$sPaternIn = "[{PORTAL_NAME}] - [{CATEGORY_NAME}]"; //default
$aPatRepl = null;
if (!empty($this->sqlData['seo_pattern'])) {
$sPaternIn = $this->sqlData['seo_pattern'];
}
$aPatRepl = array();
$activePage = $this->getActivePageService()->getActivePage();
$aPatRepl['PORTAL_NAME'] = $activePage->GetPortal()->GetTitle();
$aPatRepl['PAGE_NAME'] = $activePage->GetName();
$aPatRepl['CATEGORY_NAME'] = $this->GetName();
return $aPatRepl;
} | [
"public",
"function",
"GetSeoPattern",
"(",
"&",
"$",
"sPaternIn",
")",
"{",
"//$sPaternIn = \"[{PORTAL_NAME}] - [{CATEGORY_NAME}]\"; //default",
"$",
"aPatRepl",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"sqlData",
"[",
"'seo_pattern'",
"... | Get SEO pattern of actual article.
@param string $sPaternIn
@return array | [
"Get",
"SEO",
"pattern",
"of",
"actual",
"article",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L469-L485 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.GetProductNameExtensions | public function GetProductNameExtensions()
{
$sName = trim($this->fieldNameProduct);
if (empty($sName)) {
$sName = $this->fieldName;
}
return $sName;
} | php | public function GetProductNameExtensions()
{
$sName = trim($this->fieldNameProduct);
if (empty($sName)) {
$sName = $this->fieldName;
}
return $sName;
} | [
"public",
"function",
"GetProductNameExtensions",
"(",
")",
"{",
"$",
"sName",
"=",
"trim",
"(",
"$",
"this",
"->",
"fieldNameProduct",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"sName",
")",
")",
"{",
"$",
"sName",
"=",
"$",
"this",
"->",
"fieldName",
... | return the part of the category that should be used as part of the product name.
@return string | [
"return",
"the",
"part",
"of",
"the",
"category",
"that",
"should",
"be",
"used",
"as",
"part",
"of",
"the",
"product",
"name",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L500-L508 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.GetCurrentColorCode | public function GetCurrentColorCode($sDefaultColor = '000000')
{
$oRootCat = $this->GetRootCategory();
/** @var $oRootCat TdbShopCategory */
$sColorcode = $oRootCat->fieldColorcode;
if ('' == $sColorcode) {
$sColorcode = $sDefaultColor;
}
return $sColorcode;
} | php | public function GetCurrentColorCode($sDefaultColor = '000000')
{
$oRootCat = $this->GetRootCategory();
/** @var $oRootCat TdbShopCategory */
$sColorcode = $oRootCat->fieldColorcode;
if ('' == $sColorcode) {
$sColorcode = $sDefaultColor;
}
return $sColorcode;
} | [
"public",
"function",
"GetCurrentColorCode",
"(",
"$",
"sDefaultColor",
"=",
"'000000'",
")",
"{",
"$",
"oRootCat",
"=",
"$",
"this",
"->",
"GetRootCategory",
"(",
")",
";",
"/** @var $oRootCat TdbShopCategory */",
"$",
"sColorcode",
"=",
"$",
"oRootCat",
"->",
... | returns the category color.
@param string $sDefaultColor - default color = black;
@return string | [
"returns",
"the",
"category",
"color",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L517-L527 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopCategory.class.php | TShopCategory.parentCategoriesAreActive | public function parentCategoriesAreActive()
{
$treeIsActive = true;
$parentCategoryList = $this->getParentCategories();
while ($category = $parentCategoryList->Next()) {
if (false === $category->fieldActive) {
$treeIsActive = false;
break;
}
}
return $treeIsActive;
} | php | public function parentCategoriesAreActive()
{
$treeIsActive = true;
$parentCategoryList = $this->getParentCategories();
while ($category = $parentCategoryList->Next()) {
if (false === $category->fieldActive) {
$treeIsActive = false;
break;
}
}
return $treeIsActive;
} | [
"public",
"function",
"parentCategoriesAreActive",
"(",
")",
"{",
"$",
"treeIsActive",
"=",
"true",
";",
"$",
"parentCategoryList",
"=",
"$",
"this",
"->",
"getParentCategories",
"(",
")",
";",
"while",
"(",
"$",
"category",
"=",
"$",
"parentCategoryList",
"->... | return true if the tree until this category is active.
@return bool | [
"return",
"true",
"if",
"the",
"tree",
"until",
"this",
"category",
"is",
"active",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopCategory.class.php#L542-L554 | train |
edmondscommerce/doctrine-static-meta | codeTemplates/src/Entity/Savers/TemplateEntityUpserter.php | TemplateEntityUpserter.getUpsertDtoByCriteria | public function getUpsertDtoByCriteria(
array $criteria,
NewUpsertDtoDataModifierInterface $modifier
): TemplateEntityDto {
$entity = $this->repository->findOneBy($criteria);
if ($entity === null) {
$dto = $this->dtoFactory->create();
$modifier->addDataToNewlyCreatedDto($dto);
return $dto;
}
return $this->dtoFactory->createDtoFromTemplateEntity($entity);
} | php | public function getUpsertDtoByCriteria(
array $criteria,
NewUpsertDtoDataModifierInterface $modifier
): TemplateEntityDto {
$entity = $this->repository->findOneBy($criteria);
if ($entity === null) {
$dto = $this->dtoFactory->create();
$modifier->addDataToNewlyCreatedDto($dto);
return $dto;
}
return $this->dtoFactory->createDtoFromTemplateEntity($entity);
} | [
"public",
"function",
"getUpsertDtoByCriteria",
"(",
"array",
"$",
"criteria",
",",
"NewUpsertDtoDataModifierInterface",
"$",
"modifier",
")",
":",
"TemplateEntityDto",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"repository",
"->",
"findOneBy",
"(",
"$",
"criteri... | This method is used to get a DTO using search criteria, when you are not certain if the entity exists or not.
The criteria is passed through to the repository findOneBy method, if an entity is found then a DTO will be
created from it and returned.
If an entity is not found then a new empty DTO will be created and returned instead.
@param array $criteria
@param NewUpsertDtoDataModifierInterface $modifier
@return TemplateEntityDto
@see \Doctrine\ORM\EntityRepository::findOneBy for how to use the crietia | [
"This",
"method",
"is",
"used",
"to",
"get",
"a",
"DTO",
"using",
"search",
"criteria",
"when",
"you",
"are",
"not",
"certain",
"if",
"the",
"entity",
"exists",
"or",
"not",
".",
"The",
"criteria",
"is",
"passed",
"through",
"to",
"the",
"repository",
"f... | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/codeTemplates/src/Entity/Savers/TemplateEntityUpserter.php#L92-L105 | train |
edmondscommerce/doctrine-static-meta | codeTemplates/src/Entity/Savers/TemplateEntityUpserter.php | TemplateEntityUpserter.persistUpsertDto | public function persistUpsertDto(TemplateEntityDto $dto): TemplateEntityInterface
{
$entity = $this->convertUpsertDtoToEntity($dto);
$this->saver->save($entity);
return $entity;
} | php | public function persistUpsertDto(TemplateEntityDto $dto): TemplateEntityInterface
{
$entity = $this->convertUpsertDtoToEntity($dto);
$this->saver->save($entity);
return $entity;
} | [
"public",
"function",
"persistUpsertDto",
"(",
"TemplateEntityDto",
"$",
"dto",
")",
":",
"TemplateEntityInterface",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"convertUpsertDtoToEntity",
"(",
"$",
"dto",
")",
";",
"$",
"this",
"->",
"saver",
"->",
"save",
... | This is used to persist the DTO to the database. If the DTO is for a new entity then it will be created, if it
is for an existing Entity then it will be updated.
Be aware that this method should __only__ be used with DTOs that have been created using the
self::getUpsertDtoByCriteria method, as if they come from elsewhere we will not not if the entity needs to be
created or updated
@param TemplateEntityDto $dto
@return TemplateEntityInterface
@throws \Doctrine\DBAL\DBALException | [
"This",
"is",
"used",
"to",
"persist",
"the",
"DTO",
"to",
"the",
"database",
".",
"If",
"the",
"DTO",
"is",
"for",
"a",
"new",
"entity",
"then",
"it",
"will",
"be",
"created",
"if",
"it",
"is",
"for",
"an",
"existing",
"Entity",
"then",
"it",
"will"... | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/codeTemplates/src/Entity/Savers/TemplateEntityUpserter.php#L127-L133 | train |
edmondscommerce/doctrine-static-meta | codeTemplates/src/Entity/Savers/TemplateEntityUpserter.php | TemplateEntityUpserter.convertUpsertDtoToEntity | public function convertUpsertDtoToEntity(TemplateEntityDto $dto): TemplateEntityInterface
{
if ($this->unitOfWorkHelper->hasRecordOfDto($dto) === false) {
$entity = $this->entityFactory->create($dto);
return $entity;
}
$entity = $this->unitOfWorkHelper->getEntityFromUnitOfWorkUsingDto($dto);
$entity->update($dto);
return $entity;
} | php | public function convertUpsertDtoToEntity(TemplateEntityDto $dto): TemplateEntityInterface
{
if ($this->unitOfWorkHelper->hasRecordOfDto($dto) === false) {
$entity = $this->entityFactory->create($dto);
return $entity;
}
$entity = $this->unitOfWorkHelper->getEntityFromUnitOfWorkUsingDto($dto);
$entity->update($dto);
return $entity;
} | [
"public",
"function",
"convertUpsertDtoToEntity",
"(",
"TemplateEntityDto",
"$",
"dto",
")",
":",
"TemplateEntityInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"unitOfWorkHelper",
"->",
"hasRecordOfDto",
"(",
"$",
"dto",
")",
"===",
"false",
")",
"{",
"$",
"en... | This method will convert the DTO into an entity, but will not save it. This is useful if you want to bulk create
or update entities
@param TemplateEntityDto $dto
@return TemplateEntityInterface | [
"This",
"method",
"will",
"convert",
"the",
"DTO",
"into",
"an",
"entity",
"but",
"will",
"not",
"save",
"it",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"bulk",
"create",
"or",
"update",
"entities"
] | c5b1caab0b2e3a84c34082af96529a274f0c3d7e | https://github.com/edmondscommerce/doctrine-static-meta/blob/c5b1caab0b2e3a84c34082af96529a274f0c3d7e/codeTemplates/src/Entity/Savers/TemplateEntityUpserter.php#L143-L154 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php | TPkgShopWishlist.AddArticle | public function AddArticle($sArticleId, $dAmount = 1, $sComment = null)
{
$dNewAmount = 0;
$aItemData = array();
$oItem = TdbPkgShopWishlistArticle::GetNewInstance();
/** @var $oItem TdbPkgShopWishlistArticle */
if ($oItem->LoadFromFields(array('pkg_shop_wishlist_id' => $this->id, 'shop_article_id' => $sArticleId))) {
$aItemData = $oItem->sqlData;
$aItemData['amount'] += $dAmount;
} else {
$aItemData['pkg_shop_wishlist_id'] = $this->id;
$aItemData['shop_article_id'] = $sArticleId;
$aItemData['amount'] = $dAmount;
$aItemData['datecreated'] = date('Y-m-d H:i:s');
}
if (!is_null($sComment)) {
$aItemData['comment'] = $oItem->LoadFromRow($aItemData);
}
$oItem->LoadFromRow($aItemData);
$oItem->AllowEditByAll(true);
$oItem->Save();
$dNewAmount = $aItemData['amount'];
return $dNewAmount;
} | php | public function AddArticle($sArticleId, $dAmount = 1, $sComment = null)
{
$dNewAmount = 0;
$aItemData = array();
$oItem = TdbPkgShopWishlistArticle::GetNewInstance();
/** @var $oItem TdbPkgShopWishlistArticle */
if ($oItem->LoadFromFields(array('pkg_shop_wishlist_id' => $this->id, 'shop_article_id' => $sArticleId))) {
$aItemData = $oItem->sqlData;
$aItemData['amount'] += $dAmount;
} else {
$aItemData['pkg_shop_wishlist_id'] = $this->id;
$aItemData['shop_article_id'] = $sArticleId;
$aItemData['amount'] = $dAmount;
$aItemData['datecreated'] = date('Y-m-d H:i:s');
}
if (!is_null($sComment)) {
$aItemData['comment'] = $oItem->LoadFromRow($aItemData);
}
$oItem->LoadFromRow($aItemData);
$oItem->AllowEditByAll(true);
$oItem->Save();
$dNewAmount = $aItemData['amount'];
return $dNewAmount;
} | [
"public",
"function",
"AddArticle",
"(",
"$",
"sArticleId",
",",
"$",
"dAmount",
"=",
"1",
",",
"$",
"sComment",
"=",
"null",
")",
"{",
"$",
"dNewAmount",
"=",
"0",
";",
"$",
"aItemData",
"=",
"array",
"(",
")",
";",
"$",
"oItem",
"=",
"TdbPkgShopWis... | adds an article to the wishlist - returns the new amount of that article on the list.
@param string $sArticleId
@param float $dAmount
@param string $sComment - optional comment
@return float | [
"adds",
"an",
"article",
"to",
"the",
"wishlist",
"-",
"returns",
"the",
"new",
"amount",
"of",
"that",
"article",
"on",
"the",
"list",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php#L27-L51 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php | TPkgShopWishlist.GetLink | public function GetLink($sMode = '', $aAdditionalParameter = array())
{
if (!empty($sMode)) {
$aAdditionalParameter[MTPkgShopWishlistCore::URL_MODE_PARAMETER_NAME] = $sMode;
}
$oShopConfig = TdbShop::GetInstance();
return $oShopConfig->GetLinkToSystemPage('wishlist', $aAdditionalParameter, true);
} | php | public function GetLink($sMode = '', $aAdditionalParameter = array())
{
if (!empty($sMode)) {
$aAdditionalParameter[MTPkgShopWishlistCore::URL_MODE_PARAMETER_NAME] = $sMode;
}
$oShopConfig = TdbShop::GetInstance();
return $oShopConfig->GetLinkToSystemPage('wishlist', $aAdditionalParameter, true);
} | [
"public",
"function",
"GetLink",
"(",
"$",
"sMode",
"=",
"''",
",",
"$",
"aAdditionalParameter",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"sMode",
")",
")",
"{",
"$",
"aAdditionalParameter",
"[",
"MTPkgShopWishlistCore",
"::",... | return link to the private view of the wishlist.
@param string $sMode - select a mode of the wishlist (such as SendForm)
@param array $aAdditionalParameter
@return string | [
"return",
"link",
"to",
"the",
"private",
"view",
"of",
"the",
"wishlist",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php#L95-L103 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php | TPkgShopWishlist.GetPublicLink | public function GetPublicLink($aAdditionalParameter = array())
{
$oShopConfig = TdbShop::GetInstance();
$aAdditionalParameter[MTPkgShopWishlistPublicCore::URL_PARAMETER_NAME] = array('id' => $this->id);
return $oShopConfig->GetLinkToSystemPage('wishlist-public', $aAdditionalParameter, true);
} | php | public function GetPublicLink($aAdditionalParameter = array())
{
$oShopConfig = TdbShop::GetInstance();
$aAdditionalParameter[MTPkgShopWishlistPublicCore::URL_PARAMETER_NAME] = array('id' => $this->id);
return $oShopConfig->GetLinkToSystemPage('wishlist-public', $aAdditionalParameter, true);
} | [
"public",
"function",
"GetPublicLink",
"(",
"$",
"aAdditionalParameter",
"=",
"array",
"(",
")",
")",
"{",
"$",
"oShopConfig",
"=",
"TdbShop",
"::",
"GetInstance",
"(",
")",
";",
"$",
"aAdditionalParameter",
"[",
"MTPkgShopWishlistPublicCore",
"::",
"URL_PARAMETER... | return the public link to the wishlist.
@param array $aAdditionalParameter
@return string | [
"return",
"the",
"public",
"link",
"to",
"the",
"wishlist",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php#L112-L118 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php | TPkgShopWishlist.& | public function &GetFieldPkgShopWishlistArticleList()
{
$oWishlistItems = $this->GetFromInternalCache('oPkgShopWishlistArticleList');
if (is_null($oWishlistItems)) {
$oWishlistItems = TdbPkgShopWishlistArticleList::GetListForPkgShopWishlistId($this->id, $this->iLanguageId);
$oWishlistItems->bAllowItemCache = true;
$this->SetInternalCache('oPkgShopWishlistArticleList', $oWishlistItems);
}
$oWishlistItems->GoToStart();
return $oWishlistItems;
} | php | public function &GetFieldPkgShopWishlistArticleList()
{
$oWishlistItems = $this->GetFromInternalCache('oPkgShopWishlistArticleList');
if (is_null($oWishlistItems)) {
$oWishlistItems = TdbPkgShopWishlistArticleList::GetListForPkgShopWishlistId($this->id, $this->iLanguageId);
$oWishlistItems->bAllowItemCache = true;
$this->SetInternalCache('oPkgShopWishlistArticleList', $oWishlistItems);
}
$oWishlistItems->GoToStart();
return $oWishlistItems;
} | [
"public",
"function",
"&",
"GetFieldPkgShopWishlistArticleList",
"(",
")",
"{",
"$",
"oWishlistItems",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oPkgShopWishlistArticleList'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oWishlistItems",
")",
")",
"{",
... | Artikel der Wunschliste.
@return TdbPkgShopWishlistArticleList | [
"Artikel",
"der",
"Wunschliste",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php#L137-L148 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php | TPkgShopWishlist.& | public function &GetFieldPkgShopWishlistMailHistoryList()
{
$oWishlistHistoryItems = $this->GetFromInternalCache('oPkgShopWishlistMailHistoryList');
if (is_null($oWishlistHistoryItems)) {
$oWishlistHistoryItems = TdbPkgShopWishlistMailHistoryList::GetListForPkgShopWishlistId($this->id, $this->iLanguageId);
$oWishlistHistoryItems->bAllowItemCache = true;
$this->SetInternalCache('oPkgShopWishlistMailHistoryList', $oWishlistHistoryItems);
}
return $oWishlistHistoryItems;
} | php | public function &GetFieldPkgShopWishlistMailHistoryList()
{
$oWishlistHistoryItems = $this->GetFromInternalCache('oPkgShopWishlistMailHistoryList');
if (is_null($oWishlistHistoryItems)) {
$oWishlistHistoryItems = TdbPkgShopWishlistMailHistoryList::GetListForPkgShopWishlistId($this->id, $this->iLanguageId);
$oWishlistHistoryItems->bAllowItemCache = true;
$this->SetInternalCache('oPkgShopWishlistMailHistoryList', $oWishlistHistoryItems);
}
return $oWishlistHistoryItems;
} | [
"public",
"function",
"&",
"GetFieldPkgShopWishlistMailHistoryList",
"(",
")",
"{",
"$",
"oWishlistHistoryItems",
"=",
"$",
"this",
"->",
"GetFromInternalCache",
"(",
"'oPkgShopWishlistMailHistoryList'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"oWishlistHistoryItems",... | Wunschslisten Mailhistory.
@return TdbPkgShopWishlistMailHistoryList | [
"Wunschslisten",
"Mailhistory",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php#L155-L165 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php | TPkgShopWishlist.GetDescriptionAsHTML | public function GetDescriptionAsHTML()
{
$sText = trim($this->fieldDescription);
$sText = TGlobal::OutHTML($sText);
$sText = nl2br($sText);
return $sText;
} | php | public function GetDescriptionAsHTML()
{
$sText = trim($this->fieldDescription);
$sText = TGlobal::OutHTML($sText);
$sText = nl2br($sText);
return $sText;
} | [
"public",
"function",
"GetDescriptionAsHTML",
"(",
")",
"{",
"$",
"sText",
"=",
"trim",
"(",
"$",
"this",
"->",
"fieldDescription",
")",
";",
"$",
"sText",
"=",
"TGlobal",
"::",
"OutHTML",
"(",
"$",
"sText",
")",
";",
"$",
"sText",
"=",
"nl2br",
"(",
... | return description text as html.
@return string | [
"return",
"description",
"text",
"as",
"html",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php#L186-L193 | train |
chameleon-system/chameleon-shop | src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php | TPkgShopWishlist.SendPerMail | 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;
} | php | 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;
} | [
"public",
"function",
"SendPerMail",
"(",
"$",
"sToMail",
",",
"$",
"sToName",
",",
"$",
"sComment",
")",
"{",
"$",
"bSendSuccess",
"=",
"false",
";",
"$",
"oOwner",
"=",
"$",
"this",
"->",
"GetFieldDataExtranetUser",
"(",
")",
";",
"$",
"oMail",
"=",
... | send the wishlist per mail to a user.
@param string $sToMail
@param string $sToName
@param string $sComment
@return bool | [
"send",
"the",
"wishlist",
"per",
"mail",
"to",
"a",
"user",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopWishlistBundle/objects/db/TPkgShopWishlist.class.php#L204-L226 | train |
Erebot/Erebot | src/Event/Match/Source.php | Source.setSource | public function setSource($source)
{
if ($source !== null && !\Erebot\Utils::stringifiable($source)) {
throw new \Erebot\InvalidValueException('Not a valid nickname');
}
$this->source = $source;
} | php | public function setSource($source)
{
if ($source !== null && !\Erebot\Utils::stringifiable($source)) {
throw new \Erebot\InvalidValueException('Not a valid nickname');
}
$this->source = $source;
} | [
"public",
"function",
"setSource",
"(",
"$",
"source",
")",
"{",
"if",
"(",
"$",
"source",
"!==",
"null",
"&&",
"!",
"\\",
"Erebot",
"\\",
"Utils",
"::",
"stringifiable",
"(",
"$",
"source",
")",
")",
"{",
"throw",
"new",
"\\",
"Erebot",
"\\",
"Inval... | Sets the source used in comparisons.
\param $source string|object
Source to match incoming events against.
\throw Erebot::InvalidValueException
The given source is invalid. | [
"Sets",
"the",
"source",
"used",
"in",
"comparisons",
"."
] | 691fc3fa8bc6f07061ff2b3798fec76bc3a039aa | https://github.com/Erebot/Erebot/blob/691fc3fa8bc6f07061ff2b3798fec76bc3a039aa/src/Event/Match/Source.php#L70-L77 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.GetAdditionalViewVariables | protected function GetAdditionalViewVariables($sViewName, $sViewType)
{
$aViewVariables = parent::GetAdditionalViewVariables($sViewName, $sViewType);
if (!is_array($aViewVariables)) {
$aViewVariables = array();
}
$aViewVariables['PaymentHiddenInput'] = $this->GetPaymentParameter();
$aViewVariables['PaymentHiddenInput']['sign'] = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $aViewVariables['PaymentHiddenInput']['merchantId'], $aViewVariables['PaymentHiddenInput']['amount'], $aViewVariables['PaymentHiddenInput']['currency'], $aViewVariables['PaymentHiddenInput']['refno']);
$aViewVariables['aUserAddressData'] = $this->GetUserAddressDataParameter();
$aViewVariables['aPossiblePaymentMethodCreditCardList'] = $this->GetPaymentTypeSpecificParameter();
return $aViewVariables;
} | php | protected function GetAdditionalViewVariables($sViewName, $sViewType)
{
$aViewVariables = parent::GetAdditionalViewVariables($sViewName, $sViewType);
if (!is_array($aViewVariables)) {
$aViewVariables = array();
}
$aViewVariables['PaymentHiddenInput'] = $this->GetPaymentParameter();
$aViewVariables['PaymentHiddenInput']['sign'] = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $aViewVariables['PaymentHiddenInput']['merchantId'], $aViewVariables['PaymentHiddenInput']['amount'], $aViewVariables['PaymentHiddenInput']['currency'], $aViewVariables['PaymentHiddenInput']['refno']);
$aViewVariables['aUserAddressData'] = $this->GetUserAddressDataParameter();
$aViewVariables['aPossiblePaymentMethodCreditCardList'] = $this->GetPaymentTypeSpecificParameter();
return $aViewVariables;
} | [
"protected",
"function",
"GetAdditionalViewVariables",
"(",
"$",
"sViewName",
",",
"$",
"sViewType",
")",
"{",
"$",
"aViewVariables",
"=",
"parent",
"::",
"GetAdditionalViewVariables",
"(",
"$",
"sViewName",
",",
"$",
"sViewType",
")",
";",
"if",
"(",
"!",
"is... | added all needed parameter for a request to IPayment
use this method to add any variables to the render method that you may
require for some view.
@param string $sViewName - the view being requested
@param string $sViewType - the location of the view (Core, Custom-Core, Customer)
@return array | [
"added",
"all",
"needed",
"parameter",
"for",
"a",
"request",
"to",
"IPayment",
"use",
"this",
"method",
"to",
"add",
"any",
"variables",
"to",
"the",
"render",
"method",
"that",
"you",
"may",
"require",
"for",
"some",
"view",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L71-L83 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.GetPaymentParameter | protected function GetPaymentParameter()
{
$aParameter = array();
$sCurrency = $this->GetCurrencyIdentifier();
$oLocal = &TCMSLocal::GetActive();
$oShopBasket = TShopBasket::GetInstance();
$aParameter['merchantId'] = $this->GetTestLiveModeParameter('merchantId');
$aParameter['refno'] = $this->GetRefNoParameter();
$aParameter['reqtype'] = $this->GetConfigParameter('reqtype');
$aParameter['amount'] = str_replace(',', '.', $oLocal->FormatNumber($oShopBasket->dCostTotal)) * 100;
$aParameter['currency'] = $sCurrency;
$aParameter['hiddenMode'] = $this->GetConfigParameter('hiddenMode');
$sRedirectULR = $this->GetResponseURL();
$aParameter['successUrl'] = $sRedirectULR;
$aParameter['errorUrl'] = $sRedirectULR;
$aParameter['cancelUrl'] = $sRedirectULR;
return $aParameter;
} | php | protected function GetPaymentParameter()
{
$aParameter = array();
$sCurrency = $this->GetCurrencyIdentifier();
$oLocal = &TCMSLocal::GetActive();
$oShopBasket = TShopBasket::GetInstance();
$aParameter['merchantId'] = $this->GetTestLiveModeParameter('merchantId');
$aParameter['refno'] = $this->GetRefNoParameter();
$aParameter['reqtype'] = $this->GetConfigParameter('reqtype');
$aParameter['amount'] = str_replace(',', '.', $oLocal->FormatNumber($oShopBasket->dCostTotal)) * 100;
$aParameter['currency'] = $sCurrency;
$aParameter['hiddenMode'] = $this->GetConfigParameter('hiddenMode');
$sRedirectULR = $this->GetResponseURL();
$aParameter['successUrl'] = $sRedirectULR;
$aParameter['errorUrl'] = $sRedirectULR;
$aParameter['cancelUrl'] = $sRedirectULR;
return $aParameter;
} | [
"protected",
"function",
"GetPaymentParameter",
"(",
")",
"{",
"$",
"aParameter",
"=",
"array",
"(",
")",
";",
"$",
"sCurrency",
"=",
"$",
"this",
"->",
"GetCurrencyIdentifier",
"(",
")",
";",
"$",
"oLocal",
"=",
"&",
"TCMSLocal",
"::",
"GetActive",
"(",
... | Get hidden field parameter needed for payment.
@return array | [
"Get",
"hidden",
"field",
"parameter",
"needed",
"for",
"payment",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L191-L209 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.CheckAuthorisationResponse | protected function CheckAuthorisationResponse($sMessageConsumer = '')
{
$bResponseSuccessful = false;
if (empty($sMessageConsumer)) {
$sMessageConsumer = $this->GetMsgManagerName();
}
$sReturnMessage = $this->GetErrorCodesFromResponse();
if (!empty($sReturnMessage)) {
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, $sReturnMessage);
} else {
$bResponseSuccessful = true;
}
return $bResponseSuccessful;
} | php | protected function CheckAuthorisationResponse($sMessageConsumer = '')
{
$bResponseSuccessful = false;
if (empty($sMessageConsumer)) {
$sMessageConsumer = $this->GetMsgManagerName();
}
$sReturnMessage = $this->GetErrorCodesFromResponse();
if (!empty($sReturnMessage)) {
$oMsgManager = TCMSMessageManager::GetInstance();
$oMsgManager->AddMessage($sMessageConsumer, $sReturnMessage);
} else {
$bResponseSuccessful = true;
}
return $bResponseSuccessful;
} | [
"protected",
"function",
"CheckAuthorisationResponse",
"(",
"$",
"sMessageConsumer",
"=",
"''",
")",
"{",
"$",
"bResponseSuccessful",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"sMessageConsumer",
")",
")",
"{",
"$",
"sMessageConsumer",
"=",
"$",
"this",... | if request to DataTrans was not successfully create a error message.
@param string $sMessageConsumer
@return bool | [
"if",
"request",
"to",
"DataTrans",
"was",
"not",
"successfully",
"create",
"a",
"error",
"message",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L239-L254 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.ExecuteDataTransPaymentCall | protected function ExecuteDataTransPaymentCall(TdbShopOrder &$oOrder)
{
$sXMLSettlement = $this->GetXMLSettlement();
$ch = curl_init();
$settlementurl = trim($this->GetTestLiveModeParameter('settlementurl'));
curl_setopt($ch, CURLOPT_URL, $settlementurl);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'xmlRequest='.$sXMLSettlement);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$sResponse = curl_exec($ch);
$sCurlError = curl_error($ch);
$bPaymentOk = $this->SettlementResponseSuccess($sResponse);
if (!$bPaymentOk) {
if (!empty($sCurlError)) {
TTools::WriteLogEntrySimple('Payment DataTrans: curl failed to ['.$this->GetConfigParameter('settlementurl')."] using xml [{$sXMLSettlement}] with error: ".$sCurlError, 1, __FILE__, __LINE__);
}
$iFailure = $this->GetConfigParameter('failure_settlement');
if ('1' === $iFailure) {
if ($this->SendFailureSettlementMail($oOrder)) {
$bPaymentOk = true;
} else {
TTools::WriteLogEntrySimple('Payment DataTrans: Es konnte keine Abbuchungsfehlere-mail versand werden', 1, __FILE__, __LINE__);
}
}
}
curl_close($ch);
return $bPaymentOk;
} | php | protected function ExecuteDataTransPaymentCall(TdbShopOrder &$oOrder)
{
$sXMLSettlement = $this->GetXMLSettlement();
$ch = curl_init();
$settlementurl = trim($this->GetTestLiveModeParameter('settlementurl'));
curl_setopt($ch, CURLOPT_URL, $settlementurl);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'xmlRequest='.$sXMLSettlement);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$sResponse = curl_exec($ch);
$sCurlError = curl_error($ch);
$bPaymentOk = $this->SettlementResponseSuccess($sResponse);
if (!$bPaymentOk) {
if (!empty($sCurlError)) {
TTools::WriteLogEntrySimple('Payment DataTrans: curl failed to ['.$this->GetConfigParameter('settlementurl')."] using xml [{$sXMLSettlement}] with error: ".$sCurlError, 1, __FILE__, __LINE__);
}
$iFailure = $this->GetConfigParameter('failure_settlement');
if ('1' === $iFailure) {
if ($this->SendFailureSettlementMail($oOrder)) {
$bPaymentOk = true;
} else {
TTools::WriteLogEntrySimple('Payment DataTrans: Es konnte keine Abbuchungsfehlere-mail versand werden', 1, __FILE__, __LINE__);
}
}
}
curl_close($ch);
return $bPaymentOk;
} | [
"protected",
"function",
"ExecuteDataTransPaymentCall",
"(",
"TdbShopOrder",
"&",
"$",
"oOrder",
")",
"{",
"$",
"sXMLSettlement",
"=",
"$",
"this",
"->",
"GetXMLSettlement",
"(",
")",
";",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"$",
"settlementurl",
"="... | Send settlement for authorised transaction.
@param \TdbShopOrder $oOrder
@return bool | [
"Send",
"settlement",
"for",
"authorised",
"transaction",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L478-L510 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.SendFailureSettlementMail | protected function SendFailureSettlementMail(TdbShopOrder &$oOrder)
{
$bSendMail = false;
$oMail = TdbDataMailProfile::GetProfile('payment_datatrans_error_settlement');
if (!is_null($oMail)) {
$sInfo = TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.payment_data_trans.settlement_failure_mail_info',
array(
'%ordernumber%' => $oOrder->fieldOrdernumber,
'%ref%' => $this->GetRefNoParameter(false),
)
));
$oMail->AddData('sInfo', $sInfo);
$bSendMail = $oMail->SendUsingObjectView('emails', 'Customer');
}
return $bSendMail;
} | php | protected function SendFailureSettlementMail(TdbShopOrder &$oOrder)
{
$bSendMail = false;
$oMail = TdbDataMailProfile::GetProfile('payment_datatrans_error_settlement');
if (!is_null($oMail)) {
$sInfo = TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.payment_data_trans.settlement_failure_mail_info',
array(
'%ordernumber%' => $oOrder->fieldOrdernumber,
'%ref%' => $this->GetRefNoParameter(false),
)
));
$oMail->AddData('sInfo', $sInfo);
$bSendMail = $oMail->SendUsingObjectView('emails', 'Customer');
}
return $bSendMail;
} | [
"protected",
"function",
"SendFailureSettlementMail",
"(",
"TdbShopOrder",
"&",
"$",
"oOrder",
")",
"{",
"$",
"bSendMail",
"=",
"false",
";",
"$",
"oMail",
"=",
"TdbDataMailProfile",
"::",
"GetProfile",
"(",
"'payment_datatrans_error_settlement'",
")",
";",
"if",
... | Sends email to shop owner to settle transaction manually.
@param TdbShopOrder $oOrder
@return bool | [
"Sends",
"email",
"to",
"shop",
"owner",
"to",
"settle",
"transaction",
"manually",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L519-L535 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.SettlementResponseSuccess | protected function SettlementResponseSuccess($sResponse)
{
$bSettlementResponseSuccess = true;
$sRefNo = $this->GetRefNoParameter(false);
$oXML = simplexml_load_string($sResponse);
if (isset($oXML->body->transaction->response)) {
TTools::WriteLogEntrySimple('Payment DataTrans: Erfoglreiche XML Settlement Response for transaction'.$this->sTransactionId.'and reference number '.$sRefNo, 3, __FILE__, __LINE__);
} else {
if (isset($oXML->body->transaction->error)) {
$sErrorCode = '';
$sErrorMessage = '';
if (isset($oXML->body->transaction->error->errorCode)) {
$sErrorCode = strval($oXML->body->transaction->error->errorCode);
}
if (isset($oXML->body->transaction->error->errorDetail)) {
$sErrorMessage = strval($oXML->body->transaction->error->errorDetail);
}
if (isset($oXML->body->transaction->error->errorMessage)) {
$sErrorMessage .= strval($oXML->body->transaction->error->errorMessage);
}
TTools::WriteLogEntrySimple('Payment DataTrans: Fehlerhafte XML Settlement Response for transaction'.$this->sTransactionId.'and reference number '.$sRefNo.'. CODE('.$sErrorCode.') MESSAGE('.$sErrorMessage.')'.' response: '.$sResponse, 1, __FILE__, __LINE__);
} else {
TTools::WriteLogEntrySimple('Payment DataTrans: Fehlerhafte XML Settlement Response for transaction'.$this->sTransactionId.'and reference number '.$sRefNo.' response: '.$sResponse, 1, __FILE__, __LINE__);
}
$bSettlementResponseSuccess = false;
}
return $bSettlementResponseSuccess;
} | php | protected function SettlementResponseSuccess($sResponse)
{
$bSettlementResponseSuccess = true;
$sRefNo = $this->GetRefNoParameter(false);
$oXML = simplexml_load_string($sResponse);
if (isset($oXML->body->transaction->response)) {
TTools::WriteLogEntrySimple('Payment DataTrans: Erfoglreiche XML Settlement Response for transaction'.$this->sTransactionId.'and reference number '.$sRefNo, 3, __FILE__, __LINE__);
} else {
if (isset($oXML->body->transaction->error)) {
$sErrorCode = '';
$sErrorMessage = '';
if (isset($oXML->body->transaction->error->errorCode)) {
$sErrorCode = strval($oXML->body->transaction->error->errorCode);
}
if (isset($oXML->body->transaction->error->errorDetail)) {
$sErrorMessage = strval($oXML->body->transaction->error->errorDetail);
}
if (isset($oXML->body->transaction->error->errorMessage)) {
$sErrorMessage .= strval($oXML->body->transaction->error->errorMessage);
}
TTools::WriteLogEntrySimple('Payment DataTrans: Fehlerhafte XML Settlement Response for transaction'.$this->sTransactionId.'and reference number '.$sRefNo.'. CODE('.$sErrorCode.') MESSAGE('.$sErrorMessage.')'.' response: '.$sResponse, 1, __FILE__, __LINE__);
} else {
TTools::WriteLogEntrySimple('Payment DataTrans: Fehlerhafte XML Settlement Response for transaction'.$this->sTransactionId.'and reference number '.$sRefNo.' response: '.$sResponse, 1, __FILE__, __LINE__);
}
$bSettlementResponseSuccess = false;
}
return $bSettlementResponseSuccess;
} | [
"protected",
"function",
"SettlementResponseSuccess",
"(",
"$",
"sResponse",
")",
"{",
"$",
"bSettlementResponseSuccess",
"=",
"true",
";",
"$",
"sRefNo",
"=",
"$",
"this",
"->",
"GetRefNoParameter",
"(",
"false",
")",
";",
"$",
"oXML",
"=",
"simplexml_load_stri... | Checks the response from settlement request.
No sign check on settlement response because DataTrans do not send sign in settlement response.
@param $sResponse
@return bool | [
"Checks",
"the",
"response",
"from",
"settlement",
"request",
".",
"No",
"sign",
"check",
"on",
"settlement",
"response",
"because",
"DataTrans",
"do",
"not",
"send",
"sign",
"in",
"settlement",
"response",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L545-L573 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.GetXMLSettlement | protected function GetXMLSettlement()
{
$oShopBasket = TShopBasket::GetInstance();
$sMerchantId = $this->GetTestLiveModeParameter('merchantId');
$sRefNo = $this->GetRefNoParameter(false);
$sCurrency = $this->GetCurrencyIdentifier();
$oLocal = &TCMSLocal::GetActive();
$sAmount = str_replace(',', '.', $oLocal->FormatNumber($oShopBasket->dCostTotal)) * 100;
$sXML = '<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="1">
<body merchantId="'.$this->GetTestLiveModeParameter('merchantId').'">
<transaction refno="'.$sRefNo.'">
<request>
<amount>'.$sAmount.'</amount>
<currency>'.$sCurrency.'</currency>
<uppTransactionId>'.$this->sTransactionId.'</uppTransactionId>
<transtype>'.self::PAYMENT_CREDIT_CARD_TRANS_TYPE_ID.'</transtype>
<sign>'.$this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $sMerchantId, $sAmount, $sCurrency, $sRefNo).'</sign>
</request>
</transaction>
</body>
</paymentService>';
return $sXML;
} | php | protected function GetXMLSettlement()
{
$oShopBasket = TShopBasket::GetInstance();
$sMerchantId = $this->GetTestLiveModeParameter('merchantId');
$sRefNo = $this->GetRefNoParameter(false);
$sCurrency = $this->GetCurrencyIdentifier();
$oLocal = &TCMSLocal::GetActive();
$sAmount = str_replace(',', '.', $oLocal->FormatNumber($oShopBasket->dCostTotal)) * 100;
$sXML = '<?xml version="1.0" encoding="UTF-8" ?>
<paymentService version="1">
<body merchantId="'.$this->GetTestLiveModeParameter('merchantId').'">
<transaction refno="'.$sRefNo.'">
<request>
<amount>'.$sAmount.'</amount>
<currency>'.$sCurrency.'</currency>
<uppTransactionId>'.$this->sTransactionId.'</uppTransactionId>
<transtype>'.self::PAYMENT_CREDIT_CARD_TRANS_TYPE_ID.'</transtype>
<sign>'.$this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $sMerchantId, $sAmount, $sCurrency, $sRefNo).'</sign>
</request>
</transaction>
</body>
</paymentService>';
return $sXML;
} | [
"protected",
"function",
"GetXMLSettlement",
"(",
")",
"{",
"$",
"oShopBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"sMerchantId",
"=",
"$",
"this",
"->",
"GetTestLiveModeParameter",
"(",
"'merchantId'",
")",
";",
"$",
"sRefNo",
"=",
... | Returns the xml request valeu for settlement.
@return string | [
"Returns",
"the",
"xml",
"request",
"valeu",
"for",
"settlement",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L580-L604 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php | TShopPaymentHandlerDataTrans.hexstr | protected function hexstr($hex)
{
$string = '';
for ($i = 0; $i < strlen($hex) - 1; $i += 2) {
$string .= chr(hexdec($hex[$i].$hex[$i + 1]));
}
return $string;
} | php | protected function hexstr($hex)
{
$string = '';
for ($i = 0; $i < strlen($hex) - 1; $i += 2) {
$string .= chr(hexdec($hex[$i].$hex[$i + 1]));
}
return $string;
} | [
"protected",
"function",
"hexstr",
"(",
"$",
"hex",
")",
"{",
"$",
"string",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"strlen",
"(",
"$",
"hex",
")",
"-",
"1",
";",
"$",
"i",
"+=",
"2",
")",
"{",
"$",
"string",
... | Converts hex to string. Was needed for the sign check.
@param $hex
@return string | [
"Converts",
"hex",
"to",
"string",
".",
"Was",
"needed",
"for",
"the",
"sign",
"check",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopPaymentHandler/TShopPaymentHandlerDataTrans.class.php#L631-L639 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepShippingCore.class.php | TShopStepShippingCore.ChangeShippingGroup | public function ChangeShippingGroup()
{
$oBasket = TShopBasket::GetInstance();
$this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
// check if the group is still valid. if not, reload using default
if (!$this->oActiveShippingGroup || false == $this->oActiveShippingGroup->IsAvailable()) {
$oBasket->SetActiveShippingGroup(null);
$oBasket->SetBasketRecalculationFlag(true);
$this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
}
$iShippingGroupId = null;
if (array_key_exists('shop_shipping_group_id', $this->aRequestData)) { //shop_payment_methode_id?
$iShippingGroupId = $this->aRequestData['shop_shipping_group_id'];
/** @var $oShippingGroup TdbShopShippingGroup */
$this->oActiveShippingGroup = TdbShopShippingGroup::GetNewInstance();
if (!$this->oActiveShippingGroup->Load($iShippingGroupId)) {
// if the requested group was not found, fetch default from basket again
if (is_null($this->oActiveShippingGroup)) {
$this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
}
} else {
$oBasket->SetActiveShippingGroup($this->oActiveShippingGroup);
$oBasket->SetBasketRecalculationFlag(true);
}
}
} | php | public function ChangeShippingGroup()
{
$oBasket = TShopBasket::GetInstance();
$this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
// check if the group is still valid. if not, reload using default
if (!$this->oActiveShippingGroup || false == $this->oActiveShippingGroup->IsAvailable()) {
$oBasket->SetActiveShippingGroup(null);
$oBasket->SetBasketRecalculationFlag(true);
$this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
}
$iShippingGroupId = null;
if (array_key_exists('shop_shipping_group_id', $this->aRequestData)) { //shop_payment_methode_id?
$iShippingGroupId = $this->aRequestData['shop_shipping_group_id'];
/** @var $oShippingGroup TdbShopShippingGroup */
$this->oActiveShippingGroup = TdbShopShippingGroup::GetNewInstance();
if (!$this->oActiveShippingGroup->Load($iShippingGroupId)) {
// if the requested group was not found, fetch default from basket again
if (is_null($this->oActiveShippingGroup)) {
$this->oActiveShippingGroup = $oBasket->GetActiveShippingGroup();
}
} else {
$oBasket->SetActiveShippingGroup($this->oActiveShippingGroup);
$oBasket->SetBasketRecalculationFlag(true);
}
}
} | [
"public",
"function",
"ChangeShippingGroup",
"(",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"this",
"->",
"oActiveShippingGroup",
"=",
"$",
"oBasket",
"->",
"GetActiveShippingGroup",
"(",
")",
";",
"// check if the gr... | changes the shipping group to the one passed via post or get in
shippinggroupid=id. | [
"changes",
"the",
"shipping",
"group",
"to",
"the",
"one",
"passed",
"via",
"post",
"or",
"get",
"in",
"shippinggroupid",
"=",
"id",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepShippingCore.class.php#L221-L246 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepShippingCore.class.php | TShopStepShippingCore.LoadActivePaymentMethod | protected function LoadActivePaymentMethod()
{
$oBasket = TShopBasket::GetInstance();
$this->oActivePaymentMethod = &$oBasket->GetActivePaymentMethod();
if (!is_null($this->oActiveShippingGroup)) {
$iPaymentId = null;
$bSelectionValid = true;
if (array_key_exists('shop_payment_method_id', $this->aRequestData)) {
$iPaymentId = $this->aRequestData['shop_payment_method_id'];
// make sure the entry may be selected by the user
$bSelectionValid = false;
$oUserSelectablePaymentMethods = $this->oActiveShippingGroup->GetValidPaymentMethodsSelectableByTheUser();
if (true == $oUserSelectablePaymentMethods->FindItemWithProperty('id', $iPaymentId)) {
if (is_null($this->oActivePaymentMethod) || !is_array($this->oActivePaymentMethod->sqlData) || $this->oActivePaymentMethod->id != $iPaymentId) {
$this->oActivePaymentMethod = TdbShopPaymentMethod::GetNewInstance();
if (!$this->oActivePaymentMethod->Load($iPaymentId)) {
$this->oActivePaymentMethod = null;
} else {
$bSelectionValid = true;
}
} else {
$bSelectionValid = true;
}
}
}
if (true == $bSelectionValid) {
// found one? make sure it is in the active shipping group
$oList = $oBasket->GetAvailablePaymentMethods();
if (!is_null($this->oActivePaymentMethod)) {
if (!$oList->IsInList($this->oActivePaymentMethod->id)) {
$this->oActivePaymentMethod = null;
}
}
// still nothing? just take the first one from the list
if (is_null($this->oActivePaymentMethod)) {
$oList->GoToStart();
if ($oList->Length() > 0) {
$this->oActivePaymentMethod = &$oList->Current();
}
}
}
} else {
$this->oActivePaymentMethod = null;
}
} | php | protected function LoadActivePaymentMethod()
{
$oBasket = TShopBasket::GetInstance();
$this->oActivePaymentMethod = &$oBasket->GetActivePaymentMethod();
if (!is_null($this->oActiveShippingGroup)) {
$iPaymentId = null;
$bSelectionValid = true;
if (array_key_exists('shop_payment_method_id', $this->aRequestData)) {
$iPaymentId = $this->aRequestData['shop_payment_method_id'];
// make sure the entry may be selected by the user
$bSelectionValid = false;
$oUserSelectablePaymentMethods = $this->oActiveShippingGroup->GetValidPaymentMethodsSelectableByTheUser();
if (true == $oUserSelectablePaymentMethods->FindItemWithProperty('id', $iPaymentId)) {
if (is_null($this->oActivePaymentMethod) || !is_array($this->oActivePaymentMethod->sqlData) || $this->oActivePaymentMethod->id != $iPaymentId) {
$this->oActivePaymentMethod = TdbShopPaymentMethod::GetNewInstance();
if (!$this->oActivePaymentMethod->Load($iPaymentId)) {
$this->oActivePaymentMethod = null;
} else {
$bSelectionValid = true;
}
} else {
$bSelectionValid = true;
}
}
}
if (true == $bSelectionValid) {
// found one? make sure it is in the active shipping group
$oList = $oBasket->GetAvailablePaymentMethods();
if (!is_null($this->oActivePaymentMethod)) {
if (!$oList->IsInList($this->oActivePaymentMethod->id)) {
$this->oActivePaymentMethod = null;
}
}
// still nothing? just take the first one from the list
if (is_null($this->oActivePaymentMethod)) {
$oList->GoToStart();
if ($oList->Length() > 0) {
$this->oActivePaymentMethod = &$oList->Current();
}
}
}
} else {
$this->oActivePaymentMethod = null;
}
} | [
"protected",
"function",
"LoadActivePaymentMethod",
"(",
")",
"{",
"$",
"oBasket",
"=",
"TShopBasket",
"::",
"GetInstance",
"(",
")",
";",
"$",
"this",
"->",
"oActivePaymentMethod",
"=",
"&",
"$",
"oBasket",
"->",
"GetActivePaymentMethod",
"(",
")",
";",
"if",... | loads the active payment method. | [
"loads",
"the",
"active",
"payment",
"method",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepShippingCore.class.php#L251-L296 | train |
chameleon-system/chameleon-shop | src/ShopBundle/objects/db/TShopOrderStep/TShopStepShippingCore.class.php | TShopStepShippingCore.GetHtmlHeadIncludes | public function GetHtmlHeadIncludes()
{
$aIncludes = parent::GetHtmlHeadIncludes();
if (isset($this->oActiveShippingGroup)) {
$oPaymentMethodList = TShopBasket::GetInstance()->GetAvailablePaymentMethods();
if ($oPaymentMethodList) {
while ($oPaymentMethod = $oPaymentMethodList->Next()) {
$oPaymentHandler = $oPaymentMethod->GetFieldShopPaymentHandler();
if (method_exists($oPaymentHandler, 'GetHtmlHeadIncludes')) {
$aAdditionalIncludes = $oPaymentHandler->GetHtmlHeadIncludes();
if (count($aAdditionalIncludes) > 0) {
$aIncludes = array_merge($aIncludes, $aAdditionalIncludes);
}
}
}
}
}
return $aIncludes;
} | php | public function GetHtmlHeadIncludes()
{
$aIncludes = parent::GetHtmlHeadIncludes();
if (isset($this->oActiveShippingGroup)) {
$oPaymentMethodList = TShopBasket::GetInstance()->GetAvailablePaymentMethods();
if ($oPaymentMethodList) {
while ($oPaymentMethod = $oPaymentMethodList->Next()) {
$oPaymentHandler = $oPaymentMethod->GetFieldShopPaymentHandler();
if (method_exists($oPaymentHandler, 'GetHtmlHeadIncludes')) {
$aAdditionalIncludes = $oPaymentHandler->GetHtmlHeadIncludes();
if (count($aAdditionalIncludes) > 0) {
$aIncludes = array_merge($aIncludes, $aAdditionalIncludes);
}
}
}
}
}
return $aIncludes;
} | [
"public",
"function",
"GetHtmlHeadIncludes",
"(",
")",
"{",
"$",
"aIncludes",
"=",
"parent",
"::",
"GetHtmlHeadIncludes",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"oActiveShippingGroup",
")",
")",
"{",
"$",
"oPaymentMethodList",
"=",
"TShop... | define any head includes the step needs
loads includes from payment handlers.
@return array | [
"define",
"any",
"head",
"includes",
"the",
"step",
"needs",
"loads",
"includes",
"from",
"payment",
"handlers",
"."
] | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/objects/db/TShopOrderStep/TShopStepShippingCore.class.php#L321-L342 | train |
chameleon-system/chameleon-shop | src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetCore.class.php | TShopDataExtranetCore.GetLinkLogout | public function GetLinkLogout($sSpotName)
{
$oGlobal = TGlobal::instance();
// if we are on the last page of checkout process we can't use the active page url for logout
// so we redirect to the home url with logout method as parameter
if ($oGlobal->UserDataExists(MTShopOrderWizardCore::URL_PARAM_STEP_SYSTEM_NAME) && 'thankyou' == $oGlobal->GetUserData(MTShopOrderWizardCore::URL_PARAM_STEP_SYSTEM_NAME)) {
return self::getPageService()->getLinkToPortalHomePageAbsolute().'?'.TTools::GetArrayAsURL(array('module_fnc['.$sSpotName.']' => 'Logout'));
}
return parent::GetLinkLogout($sSpotName);
} | php | public function GetLinkLogout($sSpotName)
{
$oGlobal = TGlobal::instance();
// if we are on the last page of checkout process we can't use the active page url for logout
// so we redirect to the home url with logout method as parameter
if ($oGlobal->UserDataExists(MTShopOrderWizardCore::URL_PARAM_STEP_SYSTEM_NAME) && 'thankyou' == $oGlobal->GetUserData(MTShopOrderWizardCore::URL_PARAM_STEP_SYSTEM_NAME)) {
return self::getPageService()->getLinkToPortalHomePageAbsolute().'?'.TTools::GetArrayAsURL(array('module_fnc['.$sSpotName.']' => 'Logout'));
}
return parent::GetLinkLogout($sSpotName);
} | [
"public",
"function",
"GetLinkLogout",
"(",
"$",
"sSpotName",
")",
"{",
"$",
"oGlobal",
"=",
"TGlobal",
"::",
"instance",
"(",
")",
";",
"// if we are on the last page of checkout process we can't use the active page url for logout",
"// so we redirect to the home url with logout... | returns link to current page with logout method as parameter for given spotname of extranet module if not on "thank you" page of order process
otherwise it would return link to home page with logout method as parameter for given spotname.
@param $sSpotName
@return string | [
"returns",
"link",
"to",
"current",
"page",
"with",
"logout",
"method",
"as",
"parameter",
"for",
"given",
"spotname",
"of",
"extranet",
"module",
"if",
"not",
"on",
"thank",
"you",
"page",
"of",
"order",
"process",
"otherwise",
"it",
"would",
"return",
"lin... | 2e47f4eeab604449605ee1867180c9a37a8c208e | https://github.com/chameleon-system/chameleon-shop/blob/2e47f4eeab604449605ee1867180c9a37a8c208e/src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetCore.class.php#L22-L32 | train |
PGB-LIV/php-ms | src/Utility/Fragment/AbstractFragment.php | AbstractFragment.getChargedIon | protected function getChargedIon($mass, $charge)
{
$chargedMass = $mass + (PhysicalConstants::PROTON_MASS * $charge);
return $chargedMass / $charge;
} | php | protected function getChargedIon($mass, $charge)
{
$chargedMass = $mass + (PhysicalConstants::PROTON_MASS * $charge);
return $chargedMass / $charge;
} | [
"protected",
"function",
"getChargedIon",
"(",
"$",
"mass",
",",
"$",
"charge",
")",
"{",
"$",
"chargedMass",
"=",
"$",
"mass",
"+",
"(",
"PhysicalConstants",
"::",
"PROTON_MASS",
"*",
"$",
"charge",
")",
";",
"return",
"$",
"chargedMass",
"/",
"$",
"cha... | Charges the mass to the specified charge
@param double $mass
The neutral mass to charge
@param int $charge
The integer charge value to charge too
@return double | [
"Charges",
"the",
"mass",
"to",
"the",
"specified",
"charge"
] | 091751eb12512f4bc6ada07bda745ce49331e24f | https://github.com/PGB-LIV/php-ms/blob/091751eb12512f4bc6ada07bda745ce49331e24f/src/Utility/Fragment/AbstractFragment.php#L177-L181 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.