Compare commits

...

20 commits

Author SHA1 Message Date
Jens Schuppe
b8f44d962d Back to dev (1.6-dev) 2025-02-21 13:14:04 +01:00
Jens Schuppe
21f29ce169 Version 1.5.0 2025-02-21 13:13:44 +01:00
Jens Schuppe
c8a577b651 Back to dev (1.5-dev) 2025-01-23 15:18:14 +01:00
Jens Schuppe
2ee06faf34 Version 1.5-beta4 2025-01-23 15:17:54 +01:00
Jens Schuppe
b9b26d9524 Merge branch 'fixClassNamespaces'
[#105] Fix BAO class namespace issues
2024-10-09 13:12:32 +02:00
Jens Schuppe
c7c766d926 Fix BAO class namespace issues 2024-10-09 12:39:57 +02:00
Jens Schuppe
82952a0162 Back to 1.5-dev 2024-10-01 14:28:06 +02:00
Jens Schuppe
eaf9d53169 Version 1.5-beta3 2024-10-01 14:27:53 +02:00
Jens Schuppe
e26b5c3933 Merge branch 'germanTranslation'
[#103] Update German translation
2024-10-01 14:25:49 +02:00
Jens Schuppe
82456d2ae4 Update German translation 2024-10-01 14:24:23 +02:00
Jens Schuppe
9c9fed20d7 Back to 1.5-dev 2024-09-24 14:29:38 +02:00
Jens Schuppe
30c34f72be Version 1.5-beta2 2024-09-24 14:29:26 +02:00
Jens Schuppe
355a377c4f Merge branch 'translationTemplate'
[#101] Update translation template and fix incorrect use of ts()
2024-09-24 14:28:58 +02:00
Jens Schuppe
612224901a Update translation template 2024-09-24 14:28:34 +02:00
Jens Schuppe
fa301676e3 Update translation template and fix incorrect use of ts() 2024-09-24 14:26:37 +02:00
Jens Schuppe
2834f8028d Merge branch 'formTemplates'
[#100] Fix form template issues (help texts, undefined template variables, etc.)
2024-09-24 14:26:16 +02:00
Jens Schuppe
f6cd3614c3 Merge branch 'twingleShopFixes'
[#99] Fix DAO/BAO namespaces and definitions
2024-09-24 14:25:52 +02:00
Jens Schuppe
4ae20a1b04 Fix form template issues (help texts, undefined template variables, etc.) 2024-09-11 13:19:54 +02:00
Jens Schuppe
64d6b48813 Fix DAO/BAO namespaces and definitions 2024-09-11 12:59:22 +02:00
Jens Schuppe
7cca29b458 Back to 1.5-dev 2024-09-03 13:19:48 +02:00
27 changed files with 1611 additions and 413 deletions

View file

@ -1,16 +1,10 @@
<?php
namespace Civi\Twingle\Shop\BAO;
use Civi\Api4\PriceField;
use Civi\Twingle\Shop\DAO\TwingleProduct as TwingleProductDAO;
use Civi\Twingle\Shop\DAO\TwingleShop as TwingleShopDAO;
use Civi\Api4\PriceFieldValue;
use Civi\Twingle\Shop\Exceptions\ProductException;
use Civi\Twingle\Shop\Exceptions\ShopException;
use CRM_Core_Exception;
use CRM_Core_Transaction;
use CRM_Twingle_ExtensionUtil as E;
use CRM_Utils_Type;
use function Civi\Twingle\Shop\Utils\convert_int_to_bool;
use function Civi\Twingle\Shop\Utils\convert_str_to_date;
use function Civi\Twingle\Shop\Utils\convert_str_to_int;
@ -24,7 +18,7 @@ require_once E::path() . '/Civi/Twingle/Shop/Utils/TwingleShopUtils.php';
* TwingleProduct BAO class.
* This class is used to implement the logic for the TwingleProduct entity.
*/
class TwingleProduct extends TwingleProductDAO {
class CRM_Twingle_BAO_TwingleProduct extends CRM_Twingle_DAO_TwingleProduct {
/**
* Name of this product.
@ -421,14 +415,14 @@ class TwingleProduct extends TwingleProductDAO {
* @param int $external_id
* External id of the product (by Twingle)
*
* @return TwingleProduct|null
* @return CRM_Twingle_BAO_TwingleProduct|null
* TwingleProduct object or NULL if not found
*
* @throws \Civi\Twingle\Shop\Exceptions\ProductException
* @throws \Civi\Core\Exception\DBQueryException
*/
public static function findByExternalId($external_id) {
$dao = TwingleShopDAO::executeQuery("SELECT * FROM civicrm_twingle_product WHERE external_id = %1",
$dao = CRM_Twingle_BAO_TwingleShop::executeQuery("SELECT * FROM civicrm_twingle_product WHERE external_id = %1",
[1 => [$external_id, 'String']]);
if ($dao->fetch()) {
$product = new self();
@ -456,7 +450,7 @@ class TwingleProduct extends TwingleProductDAO {
// Try to lookup object in database
try {
$dao = TwingleShopDAO::executeQuery("SELECT * FROM civicrm_twingle_product WHERE external_id = %1",
$dao = CRM_Twingle_BAO_TwingleShop::executeQuery("SELECT * FROM civicrm_twingle_product WHERE external_id = %1",
[1 => [$this->external_id, 'String']]);
if ($dao->fetch()) {
$this->copyValues(array_merge($dao->toArray(), $this->getAttributes()));
@ -464,7 +458,7 @@ class TwingleProduct extends TwingleProductDAO {
}
catch (\Civi\Core\Exception\DBQueryException $e) {
throw new ProductException(
E::ts('Could not find TwingleProduct in database: ' . $e->getMessage()),
E::ts('Could not find TwingleProduct in database: %1', [1 => $e->getMessage()]),
ShopException::ERROR_CODE_COULD_NOT_FIND_SHOP_IN_DB);
}
@ -472,7 +466,8 @@ class TwingleProduct extends TwingleProductDAO {
$twingle_product_values = $this->getAttributes();
try {
\CRM_Utils_Hook::pre($mode, 'TwingleProduct', $this->id, $twingle_product_values);
} catch (\Exception $e) {
}
catch (\Exception $e) {
$tx->rollback();
throw $e;
}
@ -487,14 +482,15 @@ class TwingleProduct extends TwingleProductDAO {
// Save object to database
try {
$this->save();
} catch (\Exception $e) {
}
catch (\Exception $e) {
$tx->rollback();
throw new ProductException(
E::ts('Could not save TwingleProduct to database: ' . $e->getMessage()),
E::ts('Could not save TwingleProduct to database: %1', [1 => $e->getMessage()]),
ProductException::ERROR_CODE_COULD_NOT_CREATE_PRODUCT);
}
$result = self::findById($this->id);
/* @var self $result */
/** @var self $result */
$this->load($result->getAttributes());
// Register post-hook
@ -514,7 +510,7 @@ class TwingleProduct extends TwingleProductDAO {
/**
* Delete TwingleProduct along with associated PriceField and PriceFieldValue.
*
* @override \Civi\Twingle\Shop\DAO\TwingleProduct::delete
* @override \CRM_Twingle_DAO_TwingleProduct::delete
* @throws \CRM_Core_Exception
* @throws \Civi\Twingle\Shop\Exceptions\ProductException
*/
@ -570,7 +566,7 @@ class TwingleProduct extends TwingleProductDAO {
/**
* Compare two products
*
* @param TwingleProduct $product_to_compare_with
* @param CRM_Twingle_BAO_TwingleProduct $product_to_compare_with
* Product from database
*
* @return bool
@ -592,7 +588,7 @@ class TwingleProduct extends TwingleProductDAO {
*/
public function getFinancialTypeId(): ?int {
if (!empty($this->price_field_id)) {
$price_set = \Civi\Api4\PriceField::get()
$price_set = PriceField::get()
->addSelect('financial_type_id')
->addWhere('id', '=', $this->price_field_id)
->execute()
@ -610,7 +606,7 @@ class TwingleProduct extends TwingleProductDAO {
*/
public function getPriceFieldValueId() {
if (!empty($this->price_field_id)) {
$price_field_value = \Civi\Api4\PriceFieldValue::get()
$price_field_value = PriceFieldValue::get()
->addSelect('id')
->addWhere('price_field_id', '=', $this->price_field_id)
->execute()
@ -635,7 +631,7 @@ class TwingleProduct extends TwingleProductDAO {
}
catch (CRM_Core_Exception $e) {
throw new ProductException(
E::ts('An Error occurred while searching for the associated PriceFieldValue: ' . $e->getMessage()),
E::ts('An Error occurred while searching for the associated PriceFieldValue: %1', [1 => $e->getMessage()]),
ProductException::ERROR_CODE_PRICE_FIELD_VALUE_NOT_FOUND);
}
try {
@ -643,7 +639,7 @@ class TwingleProduct extends TwingleProductDAO {
}
catch (CRM_Core_Exception $e) {
throw new ProductException(
E::ts('Could not delete associated PriceFieldValue: ' . $e->getMessage()),
E::ts('Could not delete associated PriceFieldValue: %1', [1 => $e->getMessage()]),
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_FIELD_VALUE);
}
@ -667,13 +663,14 @@ class TwingleProduct extends TwingleProductDAO {
}
catch (CRM_Core_Exception $e) {
throw new ProductException(
E::ts('An Error occurred while searching for the associated PriceField: ' . $e->getMessage()),
E::ts('An Error occurred while searching for the associated PriceField: %1', [1 => $e->getMessage()]),
ProductException::ERROR_CODE_PRICE_FIELD_NOT_FOUND);
}
throw new ProductException(
E::ts('Could not delete associated PriceField: ' . $e->getMessage()),
E::ts('Could not delete associated PriceField: %1', [1 => $e->getMessage()]),
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_FIELD);
}
$this->price_field_id = NULL;
}
}

View file

@ -1,15 +1,10 @@
<?php
namespace Civi\Twingle\Shop\BAO;
// phpcs:disable
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\DAO\TwingleShop as TwingleShopDAO;
use Civi\Twingle\Shop\BAO\TwingleProduct as TwingleProductBAO;
use Civi\Twingle\Shop\ApiCall;
use Civi\Twingle\Shop\Exceptions\ShopException;
use Civi\Twingle\Shop\Exceptions\ProductException;
use Exception;
use function Civi\Twingle\Shop\Utils\filter_attributes;
use function Civi\Twingle\Shop\Utils\convert_str_to_int;
use function Civi\Twingle\Shop\Utils\validate_data_types;
@ -17,7 +12,7 @@ use function Civi\Twingle\Shop\Utils\validate_data_types;
require_once E::path() . '/Civi/Twingle/Shop/Utils/TwingleShopUtils.php';
class TwingleShop extends TwingleShopDAO {
class CRM_Twingle_BAO_TwingleShop extends CRM_Twingle_DAO_TwingleShop {
public const ALLOWED_ATTRIBUTES = [
'id' => \CRM_Utils_Type::T_INT,
@ -64,14 +59,14 @@ class TwingleShop extends TwingleShopDAO {
* @param string $project_identifier
* Twingle project identifier
*
* @return TwingleShop
* @return CRM_Twingle_BAO_TwingleShop
*
* @throws ShopException
* @throws \Civi\Twingle\Shop\Exceptions\ApiCallError
* @throws \CRM_Core_Exception
*/
public static function findByProjectIdentifier(string $project_identifier) {
$shop = new TwingleShop();
$shop = new CRM_Twingle_BAO_TwingleShop();
$shop->get('project_identifier', $project_identifier);
if (!$shop->id) {
$shop->fetchDataFromTwingle($project_identifier);
@ -147,14 +142,15 @@ class TwingleShop extends TwingleShopDAO {
// Try to lookup object in database
try {
$dao = TwingleShopDAO::executeQuery("SELECT * FROM civicrm_twingle_shop WHERE project_identifier = %1",
$dao = self::executeQuery("SELECT * FROM civicrm_twingle_shop WHERE project_identifier = %1",
[1 => [$this->project_identifier, 'String']]);
if ($dao->fetch()) {
$this->load($dao->toArray());
}
} catch (\Civi\Core\Exception\DBQueryException $e) {
}
catch (\Civi\Core\Exception\DBQueryException $e) {
throw new ShopException(
E::ts('Could not find TwingleShop in database: ' . $e->getMessage()),
E::ts('Could not find TwingleShop in database: %1', [1 => $e->getMessage()]),
ShopException::ERROR_CODE_COULD_NOT_FIND_SHOP_IN_DB);
}
@ -196,7 +192,7 @@ class TwingleShop extends TwingleShopDAO {
catch (\CRM_Core_Exception $e) {
if ($e->getMessage() != 'Expected one PriceSet but found 0') {
throw new ShopException(
E::ts('Could not find associated PriceSet: ' . $e->getMessage()),
E::ts('Could not find associated PriceSet: %1', [1 => $e->getMessage()]),
ShopException::ERROR_CODE_PRICE_SET_NOT_FOUND);
}
else {
@ -212,7 +208,7 @@ class TwingleShop extends TwingleShopDAO {
['id' => $this->price_set_id]);
} catch (\CRM_Core_Exception $e) {
throw new ShopException(
E::ts('Could not delete associated PriceSet: ' . $e->getMessage()),
E::ts('Could not delete associated PriceSet: %1', [1 => $e->getMessage()]),
ShopException::ERROR_CODE_COULD_NOT_DELETE_PRICE_SET);
}
@ -259,7 +255,7 @@ class TwingleShop extends TwingleShopDAO {
}, []);
foreach ($products_from_db as $product) {
/* @var TwingleProductBAO $product */
/* @var CRM_Twingle_BAO_TwingleProduct $product */
// Find orphaned products which are in the database but not in Twingle
$found = array_key_exists($product->external_id, $products_from_twingle);
@ -286,8 +282,8 @@ class TwingleShop extends TwingleShopDAO {
foreach ($products_from_twingle as $product_from_twingle) {
$found = array_key_exists($product_from_twingle['id'], $products);
if (!$found) {
$product = new TwingleProduct();
$product->load(TwingleProduct::renameTwingleAttrs($product_from_twingle));
$product = new CRM_Twingle_BAO_TwingleProduct();
$product->load(CRM_Twingle_BAO_TwingleProduct::renameTwingleAttrs($product_from_twingle));
$product->twingle_shop_id = $this->id;
$this->products[] = $product;
}
@ -298,20 +294,20 @@ class TwingleShop extends TwingleShopDAO {
/**
* Get associated products.
*
* @return array[Civi\Twingle\Shop\BAO\TwingleProduct]
* @return list<CRM_Twingle_BAO_TwingleProduct>
* @throws \Civi\Core\Exception\DBQueryException
* @throws \Civi\Twingle\Shop\Exceptions\ProductException
*/
public function getProducts() {
$products = [];
$result = TwingleProductBAO::executeQuery(
$result = CRM_Twingle_BAO_TwingleProduct::executeQuery(
"SELECT * FROM civicrm_twingle_product WHERE twingle_shop_id = %1",
[1 => [$this->id, 'Integer']]
);
while ($result->fetch()) {
$product = new TwingleProductBAO();
$product = new CRM_Twingle_BAO_TwingleProduct();
$product->load($result->toArray());
$products[] = $product;
}
@ -456,9 +452,10 @@ class TwingleShop extends TwingleShopDAO {
public function deleteProducts() {
try {
$products = $this->getProducts();
} catch (\Civi\Core\Exception\DBQueryException $e) {
}
catch (\Civi\Core\Exception\DBQueryException $e) {
throw new ProductException(
E::ts('Could not retrieve associated products: ' . $e->getMessage()),
E::ts('Could not retrieve associated products: %1', [1 => $e->getMessage()]),
ProductException::ERROR_CODE_COULD_NOT_GET_PRODUCTS
);
}
@ -469,8 +466,8 @@ class TwingleShop extends TwingleShopDAO {
}
catch (ProductException $e) {
throw new ProductException(
E::ts('Could not delete associated products: ' . $e->getMessage()),
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_SET
E::ts('Could not delete associated products: %1', [1 => $e->getMessage()]),
ProductException::ERROR_CODE_COULD_NOT_DELETE_PRICE_SET,
);
}
}

View file

@ -1,7 +1,5 @@
<?php
namespace Civi\Twingle\Shop\DAO;
/**
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
@ -15,7 +13,7 @@ use CRM_Twingle_ExtensionUtil as E;
/**
* Database access object for the TwingleProduct entity.
*/
class TwingleProduct extends \CRM_Core_DAO {
class CRM_Twingle_DAO_TwingleProduct extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
@ -144,7 +142,7 @@ class TwingleProduct extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_product.id',
'table_name' => 'civicrm_twingle_product',
'entity' => 'TwingleProduct',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'bao' => 'CRM_Twingle_DAO_TwingleProduct',
'localizable' => 0,
'html' => [
'type' => 'Number',
@ -167,7 +165,7 @@ class TwingleProduct extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_product.external_id',
'table_name' => 'civicrm_twingle_product',
'entity' => 'TwingleProduct',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'bao' => 'CRM_Twingle_DAO_TwingleProduct',
'localizable' => 0,
'html' => [
'type' => 'Number',
@ -189,7 +187,7 @@ class TwingleProduct extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_product.price_field_id',
'table_name' => 'civicrm_twingle_product',
'entity' => 'TwingleProduct',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'bao' => 'CRM_Twingle_DAO_TwingleProduct',
'localizable' => 0,
'FKClassName' => 'CRM_Contact_DAO_Contact',
'add' => NULL,
@ -208,9 +206,9 @@ class TwingleProduct extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_product.twingle_shop_id',
'table_name' => 'civicrm_twingle_product',
'entity' => 'TwingleProduct',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'bao' => 'CRM_Twingle_DAO_TwingleProduct',
'localizable' => 0,
'FKClassName' => 'Civi\Twingle\Shop\DAO\TwingleShop',
'FKClassName' => 'CRM_Twingle_DAO_TwingleShop',
'add' => NULL,
],
'created_at' => [
@ -228,7 +226,7 @@ class TwingleProduct extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_product.created_at',
'table_name' => 'civicrm_twingle_product',
'entity' => 'TwingleProduct',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'bao' => 'CRM_Twingle_DAO_TwingleProduct',
'localizable' => 0,
'add' => NULL,
],
@ -247,7 +245,7 @@ class TwingleProduct extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_product.updated_at',
'table_name' => 'civicrm_twingle_product',
'entity' => 'TwingleProduct',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'bao' => 'CRM_Twingle_DAO_TwingleProduct',
'localizable' => 0,
'add' => NULL,
],

View file

@ -1,7 +1,5 @@
<?php
namespace Civi\Twingle\Shop\DAO;
/**
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
@ -15,7 +13,7 @@ use CRM_Twingle_ExtensionUtil as E;
/**
* Database access object for the TwingleShop entity.
*/
class TwingleShop extends \CRM_Core_DAO {
class CRM_Twingle_DAO_TwingleShop extends CRM_Core_DAO {
const EXT = E::LONG_NAME;
const TABLE_ADDED = '';
@ -134,7 +132,7 @@ class TwingleShop extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_shop.id',
'table_name' => 'civicrm_twingle_shop',
'entity' => 'TwingleShop',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleShop',
'bao' => 'CRM_Twingle_DAO_TwingleShop',
'localizable' => 0,
'html' => [
'type' => 'Number',
@ -159,7 +157,7 @@ class TwingleShop extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_shop.project_identifier',
'table_name' => 'civicrm_twingle_shop',
'entity' => 'TwingleShop',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleShop',
'bao' => 'CRM_Twingle_DAO_TwingleShop',
'localizable' => 0,
'html' => [
'type' => 'Text',
@ -181,7 +179,7 @@ class TwingleShop extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_shop.numerical_project_id',
'table_name' => 'civicrm_twingle_shop',
'entity' => 'TwingleShop',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleShop',
'bao' => 'CRM_Twingle_DAO_TwingleShop',
'localizable' => 0,
'html' => [
'type' => 'Number',
@ -202,7 +200,7 @@ class TwingleShop extends \CRM_Core_DAO {
'where' => 'civicrm_twingle_shop.price_set_id',
'table_name' => 'civicrm_twingle_shop',
'entity' => 'TwingleShop',
'bao' => 'Civi\Twingle\Shop\DAO\TwingleShop',
'bao' => 'CRM_Twingle_DAO_TwingleShop',
'localizable' => 0,
'FKClassName' => 'CRM_Price_DAO_PriceSet',
'add' => NULL,

View file

@ -648,8 +648,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
if (!isset($profile_data[$key]) && $required) {
CRM_Core_Session::setStatus(
E::ts(
'The required configuration option "%1" has no value.'
. ' Saving the profile might set this option to a possibly unwanted default value.',
'The required configuration option "%1" has no value. Saving the profile might set this option to a possibly unwanted default value.',
[1 => $metadata['label'] ?? $key]
),
E::ts('Error'),

View file

@ -29,16 +29,16 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
* List of all settings options.
*/
public static $SETTINGS_LIST = [
'twingle_prefix',
'twingle_use_sepa',
'twingle_dont_use_reference',
'twingle_protect_recurring',
'twingle_protect_recurring_activity_type',
'twingle_protect_recurring_activity_subject',
'twingle_protect_recurring_activity_status',
'twingle_protect_recurring_activity_assignee',
'twingle_use_shop',
'twingle_access_key',
'twingle_prefix',
'twingle_use_sepa',
'twingle_dont_use_reference',
'twingle_protect_recurring',
'twingle_protect_recurring_activity_type',
'twingle_protect_recurring_activity_subject',
'twingle_protect_recurring_activity_status',
'twingle_protect_recurring_activity_assignee',
'twingle_use_shop',
'twingle_access_key',
];
/**
@ -110,22 +110,22 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
$this->add(
'checkbox',
'twingle_use_shop',
E::ts("Use Twingle Shop Integration")
E::ts('Use Twingle Shop Integration')
);
$this->add(
'text',
'twingle_access_key',
E::ts("Twingle Access Key")
E::ts('Twingle Access Key')
);
$this->addButtons(array(
array (
'type' => 'submit',
'name' => E::ts('Save'),
'isDefault' => TRUE,
)
));
$this->addButtons([
[
'type' => 'submit',
'name' => E::ts('Save'),
'isDefault' => TRUE,
],
]);
// set defaults
foreach (self::$SETTINGS_LIST as $setting) {
@ -164,7 +164,7 @@ class CRM_Twingle_Form_Settings extends CRM_Core_Form {
CRM_Utils_Array::value('twingle_use_shop', $this->_submitValues) &&
!CRM_Utils_Array::value('twingle_access_key', $this->_submitValues, FALSE)
) {
$this->_errors['twingle_access_key'] = E::ts("An Access Key is required to enable Twingle Shop Integration");
$this->_errors['twingle_access_key'] = E::ts('An Access Key is required to enable Twingle Shop Integration');
}
return (0 == count($this->_errors));

View file

@ -18,7 +18,6 @@ declare(strict_types = 1);
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Exceptions\BaseException;
use Civi\Twingle\Shop\Exceptions\LineItemException;
use Civi\Twingle\Shop\BAO\TwingleProduct;
class CRM_Twingle_Submission {
@ -503,7 +502,7 @@ class CRM_Twingle_Submission {
// Try to find the TwingleProduct with its corresponding PriceField
// for this product
try {
$price_field = TwingleProduct::findByExternalId($product['id']);
$price_field = CRM_Twingle_BAO_TwingleProduct::findByExternalId($product['id']);
}
catch (Exception $e) {
Civi::log()->error(E::LONG_NAME .
@ -546,7 +545,7 @@ class CRM_Twingle_Submission {
if (!empty($line_item['is_error'])) {
$line_item_name = $line_item_data['name'];
throw new CiviCRM_API3_Exception(
E::ts("Could not create line item for product '$line_item_name'"),
E::ts("Could not create line item for product '%1'", [1 => $line_item_name]),
'api_error'
);
}

View file

@ -2,7 +2,6 @@
use Civi\Twingle\Shop\Exceptions\ProductException;
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\BAO\TwingleProduct;
/**
* TwingleProduct.Create API specification (optional)
@ -121,7 +120,7 @@ function civicrm_api3_twingle_product_Create($params): array {
try {
// Create TwingleProduct and load params
$product = new TwingleProduct();
$product = new CRM_Twingle_BAO_TwingleProduct();
$product->load($params);
// Save TwingleProduct

View file

@ -1,7 +1,6 @@
<?php
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\BAO\TwingleProduct;
/**
* TwingleProduct.Delete API specification (optional)
@ -56,7 +55,7 @@ function civicrm_api3_twingle_product_Delete($params) {
}
// Get TwingleProduct object
$product = TwingleProduct::findById($product_data['id']);
$product = CRM_Twingle_BAO_TwingleProduct::findById($product_data['id']);
// Delete TwingleProduct and associated PriceField and PriceFieldValue
$result = $product->delete();

View file

@ -1,7 +1,6 @@
<?php
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\BAO\TwingleProduct;
/**
* TwingleProduct.Get API specification (optional)
@ -87,7 +86,7 @@ function civicrm_api3_twingle_product_Get($params) {
$altered_params = [];
// Specify product fields to define table prefix
$productFields = array_keys(TwingleProduct::fields());
$productFields = array_keys(CRM_Twingle_BAO_TwingleProduct::fields());
// Alter params (prefix with table name)
foreach ($possible_params as $param) {
@ -118,7 +117,7 @@ function civicrm_api3_twingle_product_Get($params) {
// Execute query
try {
$dao = TwingleProduct::executeQuery($query, $query_params);
$dao = CRM_Twingle_BAO_TwingleProduct::executeQuery($query, $query_params);
}
catch (Exception $e) {
return civicrm_api3_create_error($e->getMessage(), [

View file

@ -1,6 +1,5 @@
<?php
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\BAO\TwingleShop;
use Civi\Twingle\Shop\Exceptions\ShopException;
/**
@ -62,7 +61,7 @@ function civicrm_api3_twingle_shop_Create($params) {
try {
// Create TwingleShop and load params
$shop = new TwingleShop();
$shop = new CRM_Twingle_BAO_TwingleShop();
$shop->load($params);
// Save TwingleShop

View file

@ -1,6 +1,6 @@
<?php
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\BAO\TwingleShop;
/**
* TwingleShop.Delete API specification (optional)
@ -56,10 +56,10 @@ function civicrm_api3_twingle_shop_Delete($params) {
}
// Get TwingleShop object
$shop = TwingleShop::findById($shop_data['id']);
$shop = CRM_Twingle_BAO_TwingleShop::findById($shop_data['id']);
// Delete TwingleShop
/* @var \Civi\Twingle\Shop\BAO\TwingleShop $shop */
/** @var \CRM_Twingle_BAO_TwingleShop $shop */
$result = $shop->deleteByConstraint();
if ($result) {
return civicrm_api3_create_success(1, $params, 'TwingleShop', 'Delete');

View file

@ -1,7 +1,6 @@
<?php
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\BAO\TwingleShop;
use Civi\Twingle\Shop\Exceptions\ApiCallError;
use Civi\Twingle\Shop\Exceptions\ProductException;
use Civi\Twingle\Shop\Exceptions\ShopException;
@ -55,7 +54,7 @@ function civicrm_api3_twingle_shop_Fetch($params) {
// Get products for all projects of type 'shop'
foreach ($projectIds as $projectId) {
try {
$shop = TwingleShop::findByProjectIdentifier($projectId);
$shop = CRM_Twingle_BAO_TwingleShop::findByProjectIdentifier($projectId);
$products = $shop->fetchProducts();
$returnValues[$projectId] = [];
$returnValues[$projectId] += $shop->getAttributes();
@ -63,7 +62,7 @@ function civicrm_api3_twingle_shop_Fetch($params) {
return $product->getAttributes();
}, $products);
}
catch (ShopException|ApiCallError|ProductException $e) {
catch (ShopException | ApiCallError | ProductException $e) {
// If this project identifier doesn't belong to a project of type
// 'shop', just skip it
if ($e->getErrorCode() == ShopException::ERROR_CODE_NOT_A_SHOP) {

View file

@ -1,6 +1,6 @@
<?php
use CRM_Twingle_ExtensionUtil as E;
use Civi\Twingle\Shop\BAO\TwingleShop;
/**
* TwingleShop.Get API specification (optional)
@ -92,7 +92,7 @@ function civicrm_api3_twingle_shop_Get($params) {
// Execute query
try {
$dao = TwingleShop::executeQuery($query, $query_params);
$dao = CRM_Twingle_BAO_TwingleShop::executeQuery($query, $query_params);
}
catch (\Exception $e) {
return civicrm_api3_create_error($e->getMessage(), [

View file

@ -14,13 +14,17 @@
<url desc="Support">https://github.com/systopia/de.systopia.twingle/issues</url>
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls>
<releaseDate>2024-09-03</releaseDate>
<version>1.5-beta1</version>
<develStage>beta</develStage>
<releaseDate></releaseDate>
<version>1.6-dev</version>
<develStage>dev</develStage>
<compatibility>
<ver>5.58</ver>
</compatibility>
<comments/>
<comments></comments>
<classloader>
<psr4 prefix="Civi\" path="Civi"/>
<psr0 prefix="CRM_" path="."/>
</classloader>
<requires>
<ext>de.systopia.xcm</ext>
</requires>
@ -32,10 +36,7 @@
<mixin>menu-xml@1.0.0</mixin>
<mixin>mgd-php@1.0.0</mixin>
<mixin>smarty-v2@1.0.1</mixin>
<mixin>entity-types-php@1.0.0</mixin>
</mixins>
<classloader>
<psr0 prefix="CRM_" path="."/>
<psr4 prefix="Civi\" path="Civi"/>
</classloader>
<upgrader>CRM_Twingle_Upgrader</upgrader>
</extension>

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -16,6 +16,139 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid ""
"Could not find PriceField for Twingle Product ['id': %1, 'external_id': %2]: "
"%3"
msgstr ""
"PriceField für Twingle-Produkt ['id': %1, 'external_id': %2] konnte nicht "
"gefunden werden: %3"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid ""
"Could not find PriceFieldValue for Twingle Product ['id': %1, 'external_id': "
"%2]: %3"
msgstr ""
"PriceFieldValue für Twingle-Produkt ['id': %1, 'external_id': %2] konnte "
"nicht gefunden werden: %3"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "PriceField for this Twingle Product already exists."
msgstr "PriceField für dieses Twingle-Produkt existiert bereits."
#: CRM/Twingle/BAO/TwingleProduct.php
msgid ""
"PriceField for this Twingle Product does not exist and cannot be edited."
msgstr ""
"PriceField für dieses Twingle-Produkt existiert nicht und kann nicht "
"bearbeitet werden."
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not check if PriceField for this Twingle Product already exists."
msgstr ""
"Es konnte nicht überprüft werden, ob PriceField für dieses Twingle-Produkt "
"bereits existiert."
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not find PriceSet for this Twingle Product."
msgstr "PriceSet für dieses Twingle-Produkt konnte nicht gefunden werden."
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not create PriceField for this Twingle Product: %1"
msgstr "PriceField für dieses Twingle-Produkt konnte nicht erstellt werden: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not find PriceFieldValue for this Twingle Product: %1"
msgstr "PriceField für dieses Twingle-Produkt konnte nicht gefunden werden: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not create PriceFieldValue for this Twingle Product: %1"
msgstr "PriceField für dieses Twingle-Produkt konnte nicht erstellt werden: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not find TwingleProduct in database: %1"
msgstr "TwingleProduct konnte nicht in der Datenbank gefunden werden: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not save TwingleProduct to database: %1"
msgstr "TwingleProduct konnte nicht in die Datenbank geschrieben werden: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid ""
"An Error occurred while searching for the associated PriceFieldValue: %1"
msgstr ""
"Während der Suche nach zugehörigem PriceFieldValue ist ein Fehler "
"aufgetreten: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not delete associated PriceFieldValue: %1"
msgstr "Zugehöriger PriceFieldValue konnte nicht gelöscht werden: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "PriceField for this Twingle Product still exists."
msgstr "PriceField für dieses Twingle-Produkt existiert noch."
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "An Error occurred while searching for the associated PriceField: %1"
msgstr ""
"Während der Suche nach zugehörigem PriceField ist ein Fehler aufgetreten: %1"
#: CRM/Twingle/BAO/TwingleProduct.php
msgid "Could not delete associated PriceField: %1"
msgstr "Zugehöriges PriceField konnte nicht gelöscht werden: %1"
#: CRM/Twingle/BAO/TwingleShop.php
msgid "Could not find TwingleShop in database: %1"
msgstr "TwingleShop konnte nicht in der Datenbank gefunden werden: %1"
#: CRM/Twingle/BAO/TwingleShop.php
msgid "Could not find associated PriceSet: %1"
msgstr "Zugehöriges PriceSet konnte nicht gefunden werden: %1"
#: CRM/Twingle/BAO/TwingleShop.php
msgid "Could not delete associated PriceSet: %1"
msgstr "Zugehöriges PriceSet konnte nicht gelöscht werden: %1"
#: CRM/Twingle/BAO/TwingleShop.php
msgid "PriceSet for this Twingle Shop already exists."
msgstr "PriceSet für diesen Twingle-Shop existiert bereits."
#: CRM/Twingle/BAO/TwingleShop.php
msgid "PriceSet for this Twingle Shop does not exist and cannot be edited."
msgstr ""
"PriceSet für diesen Twingle-Shop existiert nicht und kann nicht bearbeitet "
"werden."
#: CRM/Twingle/BAO/TwingleShop.php
msgid "Could not check if PriceSet for this TwingleShop already exists."
msgstr ""
"Es konnte nicht überprüft werden, ob PriceSet für diesen TwingleShop bereits "
"existiert."
#: CRM/Twingle/BAO/TwingleShop.php
msgid "Could not create PriceSet for this TwingleShop."
msgstr "PriceSet für diesen TwingleShop konnte nicht erstellt werden."
#: CRM/Twingle/BAO/TwingleShop.php
msgid "This Twingle Project is not a shop."
msgstr "Dieses Twingle-Projekt ist kein Shop."
#: CRM/Twingle/BAO/TwingleShop.php
msgid ""
"Could not retrieve Twingle projects from API.\n"
" Please check your API credentials."
msgstr ""
"Twingle-Projekte konnte nicht über die API abgerufen werden. Überprüfen Sie "
"Ihre Zugangsdaten."
#: CRM/Twingle/BAO/TwingleShop.php
msgid "Could not retrieve associated products: %1"
msgstr "Zugehörige Profukte konnten nicht abgerufen werden: %1"
#: CRM/Twingle/BAO/TwingleShop.php
msgid "Could not delete associated products: %1"
msgstr "Zugehörige Produkte konnten nicht gelöscht werden: %1"
#: CRM/Twingle/Config.php
msgid "No"
msgstr "Nein"
@ -28,6 +161,108 @@ msgstr "Ausnahme auslösen"
msgid "Create Activity"
msgstr "Aktivität erstellen"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "Twingle Products"
msgstr "Twingle-Produkte"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "Twingle Product"
msgstr "Twingle-Produkt"
#: CRM/Twingle/DAO/TwingleProduct.php CRM/Twingle/DAO/TwingleShop.php
msgid "ID"
msgstr "ID"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "Unique TwingleProduct ID"
msgstr "Eindeutige TwingleProduct-ID"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "External ID"
msgstr "Externe ID"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "The ID of this product in the Twingle database"
msgstr "Die ID dieses Produkts in der Twingle-Datenbank"
#: CRM/Twingle/DAO/TwingleProduct.php api/v3/TwingleProduct/Get.php
msgid "Price Field ID"
msgstr "Preisfeld-ID"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "FK to Price Field"
msgstr "Fremdschlüssel zu Preisfeld"
#: CRM/Twingle/DAO/TwingleProduct.php api/v3/TwingleProduct/Create.php
msgid "Twingle Shop ID"
msgstr "Twingle-Shop-ID"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "FK to Twingle Shop"
msgstr "Fremdschlüssel zu Twingle-Shop"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "Created At"
msgstr "Erstellt am"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "Timestamp of when the product was created in the database"
msgstr "Zeitstempel der Erstellung des Produkts in der Datenbank"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "Updated At"
msgstr "Aktualisiert am"
#: CRM/Twingle/DAO/TwingleProduct.php
msgid "Timestamp of when the product was last updated in the database"
msgstr "Zeitstempel der letzten Aktualisierung des Produkts in der Datenbank"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "Twingle Shops"
msgstr "Twingle-Shops"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "Twingle Shop"
msgstr "Twingle-Shops"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "Unique TwingleShop ID"
msgstr "Eindeutige Twingle-Shop-ID"
#: CRM/Twingle/DAO/TwingleShop.php api/v3/TwingleProduct/Get.php
#: api/v3/TwingleShop/Create.php api/v3/TwingleShop/Delete.php
#: api/v3/TwingleShop/Get.php
msgid "Project Identifier"
msgstr "Projekt-Identifikator"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "Twingle Project Identifier"
msgstr "Twingle-Projekt-Identifikator"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "Numerical Project ID"
msgstr "Numerische Projekt-ID"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "Numerical Twingle Project Identifier"
msgstr "Numerischer Twingle-Projekt-Identifikator"
#: CRM/Twingle/DAO/TwingleShop.php api/v3/TwingleShop/Get.php
msgid "Price Set ID"
msgstr "Preisschema-ID"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "FK to Price Set"
msgstr "Fremdschlüssel zu Preisschema"
#: CRM/Twingle/DAO/TwingleShop.php api/v3/TwingleShop/Get.php
msgid "Name"
msgstr "Name"
#: CRM/Twingle/DAO/TwingleShop.php
msgid "name of the shop"
msgstr "Name des Shops"
#: CRM/Twingle/Form/Profile.php
msgid "Profile with ID \"%1\" not found"
msgstr "Profil mit ID \"%1\" nicht gefunden"
@ -40,7 +275,8 @@ msgstr "Twingle-API-Profil <em>%1</em> löschen"
msgid "Reset"
msgstr "Zurücksetzen"
#: CRM/Twingle/Form/Profile.php templates/CRM/Twingle/Page/Profiles.tpl
#: CRM/Twingle/Form/Profile.php js/twingle_shop.js
#: templates/CRM/Twingle/Page/Profiles.tpl
msgid "Delete"
msgstr "Löschen"
@ -254,6 +490,22 @@ msgstr "Kontakt-Notizen erstellen für"
msgid "User Extra Field"
msgstr "Benutzer-Extra-Feld"
#: CRM/Twingle/Form/Profile.php templates/CRM/Twingle/Form/Profile.tpl
msgid "Enable Shop Integration"
msgstr "Shop-Integration aktivieren"
#: CRM/Twingle/Form/Profile.php
msgid "Default Financial Type"
msgstr "Standard-Zuwendungsart"
#: CRM/Twingle/Form/Profile.php
msgid "Financial Type for top up donations"
msgstr "Zuwendungsart für zusätzliche Spenden"
#: CRM/Twingle/Form/Profile.php templates/CRM/Twingle/Form/Profile.tpl
msgid "Map Products as Price Fields"
msgstr "Produkte Preisfeldern zuordnen"
#: CRM/Twingle/Form/Profile.php CRM/Twingle/Form/Settings.php
msgid "Save"
msgstr "Speichern"
@ -262,6 +514,15 @@ msgstr "Speichern"
msgid "Warning"
msgstr "Warnung"
#: CRM/Twingle/Form/Profile.php
msgid ""
"The required configuration option \"%1\" has no value. Saving the profile "
"might set this option to a possibly unwanted default value."
msgstr ""
"Die erforderliche Konfigurationsoption \"%1\" hat keinen Wert. Das Speichern "
"des Profils könnte diese Option auf einen möglicherweise ungewollten "
"Standardwert setzen."
#: CRM/Twingle/Form/Profile.php
msgid "No profile set."
msgstr "Kein Profil eingestellt."
@ -314,10 +575,24 @@ msgstr "Status"
msgid "Assigned To"
msgstr "Zugewiesen an"
#: CRM/Twingle/Form/Settings.php
msgid "Use Twingle Shop Integration"
msgstr "Twingle-Shop-Integration verwenden"
#: CRM/Twingle/Form/Settings.php
msgid "Twingle Access Key"
msgstr "Twingle-Zugriffsschlüssel"
#: CRM/Twingle/Form/Settings.php
msgid "This is required for activity creation"
msgstr "Diese Angaben sind erforderlich für das Erstellen von Aktivitäten"
#: CRM/Twingle/Form/Settings.php
msgid "An Access Key is required to enable Twingle Shop Integration"
msgstr ""
"Ein Zugriffsschlüssel ist für die Aktivierung der Twingle-Shop-Integration "
"erforderlich"
#: CRM/Twingle/Form/Settings.php
msgid "-select-"
msgstr "- auswählen -"
@ -478,6 +753,10 @@ msgstr ""
msgid "Invalid format for custom fields."
msgstr "Ungültiges Format für benutzerdefinierte Felder."
#: CRM/Twingle/Submission.php
msgid "Invalid format for products."
msgstr "Ungültiges Format für Produkte."
#: CRM/Twingle/Submission.php
msgid "campaign_id must be a numeric string. "
msgstr "campaign_id muss eine numerische Zeichenkette sein. "
@ -490,6 +769,14 @@ msgstr "Unbekanntes Land %1."
msgid "Could not calculate SEPA cycle day from configuration."
msgstr "SEPA-Einzugstag konnte nicht aus der Konfiguration berechnet werden."
#: CRM/Twingle/Submission.php
msgid "Could not create line item for product '%1'"
msgstr "Belegzeile für Produkt konnte nicht erstellt werden: %1"
#: CRM/Twingle/Submission.php
msgid "Could not create line item for donation"
msgstr "Belegzeile für Spende konnte nicht erstellt werden"
#: CRM/Twingle/Tools.php
msgid ""
"This is a Twingle recurring contribution. It should be terminated through "
@ -508,6 +795,30 @@ msgstr ""
"Benutzer beendet. Es ist erforderlich, den zugehörigen Datensatz auch in "
"Twingle zu beenden, da die Zuwendung ansonsten weiter eingezogen wird."
#: Civi/Twingle/Shop/ApiCall.php
msgid "Could not find Twingle API token"
msgstr "Twingle-API-Token konnte nicht gefunden werden"
#: Civi/Twingle/Shop/ApiCall.php
msgid "Call to Twingle API failed. Please check your api token."
msgstr "Aufruf der Twingle-API fehlgeschlagen. Überprüfen Sie Ihren API-Token."
#: Civi/Twingle/Shop/ApiCall.php
msgid "GET curl failed"
msgstr "GET cURL fehlgeschlagen"
#: Civi/Twingle/Shop/ApiCall.php
msgid "http status code 404 (not found)"
msgstr "HTTP-Statuscode 404 (not found)"
#: Civi/Twingle/Shop/ApiCall.php
msgid "https status code 500 (internal error)"
msgstr "HTTP-Statuscode 500 (internal error)"
#: Civi/Twingle/Shop/ApiCall.php
msgid "Connection not yet established. Use connect() method."
msgstr "Verbindung nch nicht hergestellt. connect()-Methode verwenden."
#: api/v3/TwingleDonation/Cancel.php api/v3/TwingleDonation/Endrecurring.php
#: api/v3/TwingleDonation/Submit.php
msgid "Project ID"
@ -827,6 +1138,14 @@ msgstr ""
"Zusätzliche Informationen für entweder den Kontakt oder die (wiederkehrende) "
"Zuwendung."
#: api/v3/TwingleDonation/Submit.php
msgid "Products"
msgstr "Produkte"
#: api/v3/TwingleDonation/Submit.php
msgid "Products ordered via TwingleShop"
msgstr "Über TwingleShop bestellte Produkte"
#: api/v3/TwingleDonation/Submit.php
msgid "Additional remarks for the donation."
msgstr "Zusätzliche Anmerkungen für die Zuwendung."
@ -873,6 +1192,285 @@ msgstr ""
"Die Nachbearbeitung (postprocessing) der Twingle-Mitgliedschaft ist "
"fehlgeschlagen, siehe Protokoll für weitere Informationen."
#: api/v3/TwingleProduct/Create.php api/v3/TwingleProduct/Delete.php
#: api/v3/TwingleProduct/Get.php
msgid "TwingleProduct ID"
msgstr "TwingleProduct-ID"
#: api/v3/TwingleProduct/Create.php
msgid "The TwingleProduct ID in the database"
msgstr "Die TwingleProduct-ID in der Datenbank"
#: api/v3/TwingleProduct/Create.php
msgid "Twingle ID"
msgstr "Twingle-ID"
#: api/v3/TwingleProduct/Create.php
msgid "External product ID in Twingle database"
msgstr "Externe Produkt-ID in der Twingle-Datenbank"
#: api/v3/TwingleProduct/Create.php
msgid "ID of the corresponding Twingle Shop"
msgstr "ID des zugehlrigen Twingle-Shops"
#: api/v3/TwingleProduct/Create.php
msgid "Product Name"
msgstr "Produktname"
#: api/v3/TwingleProduct/Create.php
msgid "Name of the product"
msgstr "Name des Produkts"
#: api/v3/TwingleProduct/Create.php
msgid "Is active?"
msgstr "Status"
#: api/v3/TwingleProduct/Create.php
msgid "Is the product active?"
msgstr "Ob das Produkt aktiviert ist"
#: api/v3/TwingleProduct/Create.php
msgid "Product Description"
msgstr "Produktbeschreibung"
#: api/v3/TwingleProduct/Create.php
msgid "Short description of the product"
msgstr "Kurzbeschreibung des Produkts"
#: api/v3/TwingleProduct/Create.php
msgid "Product Price"
msgstr "Produkt-Preis"
#: api/v3/TwingleProduct/Create.php
msgid "Price of the product"
msgstr "Preis des Produkts"
#: api/v3/TwingleProduct/Create.php
msgid "Sort"
msgstr "Sortierung"
#: api/v3/TwingleProduct/Create.php
msgid "Sort order of the product"
msgstr "Sortierungsreihenfolge des Produkts"
#: api/v3/TwingleProduct/Create.php api/v3/TwingleShop/Create.php
msgid "Financial Type ID"
msgstr "Zuwendungsart"
#: api/v3/TwingleProduct/Create.php
msgid "ID of the financial type of the product"
msgstr "ID der Zuwendungsart des Produkts"
#: api/v3/TwingleProduct/Create.php
msgid "FK to TwingleShop"
msgstr "Fremdschlüssel zu TwingleShop"
#: api/v3/TwingleProduct/Create.php
msgid "Twingle timestamp"
msgstr "Twingle-Zeitstempel"
#: api/v3/TwingleProduct/Create.php
msgid "Timestamp of last update in Twingle db"
msgstr "Zeitstempel der letzten Aktualisierung in der Twingle-Datenbank"
#: api/v3/TwingleProduct/Create.php
msgid "FK to PriceField"
msgstr "Fremdschlüssel zu PriceField"
#: api/v3/TwingleProduct/Delete.php api/v3/TwingleProduct/Get.php
msgid "The TwingleProduct ID in CiviCRM"
msgstr "Die TwingleProduct-ID in CiviCRM"
#: api/v3/TwingleProduct/Delete.php api/v3/TwingleProduct/Get.php
msgid "External TwingleProduct ID"
msgstr "Externe TwingleProduct-ID"
#: api/v3/TwingleProduct/Delete.php api/v3/TwingleProduct/Get.php
msgid "Twingle's ID of the product"
msgstr "Twingles ID des Produkts"
#: api/v3/TwingleProduct/Delete.php
msgid "TwingleProduct could not be deleted."
msgstr "TwingleProduct konnte nicht gelöscht werden."
#: api/v3/TwingleProduct/Get.php
msgid "FK to civicrm_price_field"
msgstr "Fremdschlüssel zu civicrm_price_field"
#: api/v3/TwingleProduct/Get.php api/v3/TwingleShop/Delete.php
#: api/v3/TwingleShop/Get.php
msgid "TwingleShop ID"
msgstr "TwingleShop-ID"
#: api/v3/TwingleProduct/Get.php api/v3/TwingleShop/Delete.php
#: api/v3/TwingleShop/Get.php
msgid "The TwingleShop ID in CiviCRM"
msgstr "Die TwingleShop-ID in CiviCRM"
#: api/v3/TwingleProduct/Get.php api/v3/TwingleShop/Create.php
#: api/v3/TwingleShop/Delete.php api/v3/TwingleShop/Get.php
msgid "Twingle project identifier"
msgstr "Twingle-Projekt-Identifikator"
#: api/v3/TwingleProduct/Get.php api/v3/TwingleShop/Create.php
#: api/v3/TwingleShop/Get.php
msgid "Numerical Project Identifier"
msgstr "Numerischer Projekt-Identifikator"
#: api/v3/TwingleProduct/Get.php api/v3/TwingleShop/Get.php
msgid "Twingle numerical project identifier"
msgstr "Twingles numerischer Projekt-Identifikator"
#: api/v3/TwingleShop/Create.php
msgid "Numerical Twingle project identifier"
msgstr "Numerischer Twingle-Projekt-Identifikator"
#: api/v3/TwingleShop/Create.php
msgid "Shop Name"
msgstr "Shop-Name"
#: api/v3/TwingleShop/Create.php
msgid "Name of the shop"
msgstr "Name des Shops"
#: api/v3/TwingleShop/Create.php
msgid "FK to civicrm_financial_type"
msgstr "ZuwendungsartFremdschlüssel zu civicrm_financial_type"
#: api/v3/TwingleShop/Delete.php
msgid "TwingleShop could not be found."
msgstr "TwingleShop konnte nicht gefunden werden."
#: api/v3/TwingleShop/Delete.php
msgid "TwingleShop could not be deleted."
msgstr "TwingleShop konnte nicht gelöscht werden."
#: api/v3/TwingleShop/Fetch.php
msgid "Project Identifiers"
msgstr "Projekt-Identifikatoren"
#: api/v3/TwingleShop/Fetch.php
msgid "Comma separated list of Twingle project identifiers."
msgstr "Kommaseparierte Liste von Twingle-Projekt-Identifikatoren."
#: api/v3/TwingleShop/Get.php
msgid "Name of the TwingleShop"
msgstr "Name des TwingleShop"
#: api/v3/TwingleShop/Get.php
msgid "FK to civicrm_price_set"
msgstr "Fremdschlüssel zu civicrm_price_set"
#: js/twingle_shop.js
msgid "Could not fetch products"
msgstr "Produkte konnten nicht abgerufen werden"
#: js/twingle_shop.js
msgid "Could not fetch products. Please check your Twingle API key."
msgstr ""
"Produkte konnten nicht abgerufen werden. Überprüfen Sie Ihren Twingle-API-"
"Schlüssel."
#: js/twingle_shop.js
msgid "Create"
msgstr "Erstellen"
#: js/twingle_shop.js
msgid "Update"
msgstr "Bearbeiten"
#: js/twingle_shop.js
msgid "Could not create Price Field for this product"
msgstr "Preisfeld für dieses Produkt konnte nicht erstellt werden"
#: js/twingle_shop.js
msgid "Delete Price Field"
msgstr "Preisfeld löschen"
#: js/twingle_shop.js
msgid ""
"Are you sure you want to delete the price field associated with this product?"
msgstr "Möchten Sie wirklich das diesem Produkt zugehörige Preisfeld löschen?"
#: js/twingle_shop.js
msgid "Could not delete Price Field"
msgstr "Preisfeld konnte nicht gelöscht werden"
#: js/twingle_shop.js
msgid "The Price Field was deleted successfully."
msgstr "Das Preisfeld wurde erfolgreich gelöscht."
#: js/twingle_shop.js
msgid "Price Field deleted"
msgstr "Preisfeld gelöscht"
#: js/twingle_shop.js
msgid "select financial type"
msgstr "Zuwendungsart auswählen"
#: js/twingle_shop.js
msgid "Product"
msgstr "Produkt"
#: js/twingle_shop.js
msgid "Financial Type"
msgstr "Zuwendungsart"
#: js/twingle_shop.js
msgid "Price Field"
msgstr "Preisfeld"
#: js/twingle_shop.js
msgid "Create Price Set"
msgstr "Preisschema erstellen"
#: js/twingle_shop.js
msgid "Update Price Set"
msgstr "Preisschema bearbeiten"
#: js/twingle_shop.js
msgid "Delete Price Set"
msgstr "Preisschema löschen"
#: js/twingle_shop.js
msgid "Could not create Twingle Shop"
msgstr "Twingle-Shop konnte nicht erstellt werden"
#: js/twingle_shop.js
msgid "The Price Set was created successfully."
msgstr "Das Preisschema wurde erfolgreich erstellt."
#: js/twingle_shop.js
msgid "Price Field created"
msgstr "Preisfeld erstellt"
#: js/twingle_shop.js
msgid "Could not create TwingleShop"
msgstr "TwingleShop konnte nicht erstellt werden"
#: js/twingle_shop.js
msgid ""
"Are you sure you want to delete the price set associated with this Twingle "
"Shop?"
msgstr ""
"Möchten Sie wirklich das diesem Twingle-Shop zugehörige Preisschema löschen?"
#: js/twingle_shop.js
msgid "Could not delete Twingle Shop"
msgstr "Twingle-Shop konnte nicht gelöscht werden"
#: js/twingle_shop.js
msgid "The Price Set was deleted successfully."
msgstr "Das Preisschema wurde erfolgreiche gelöscht."
#: js/twingle_shop.js
msgid "Price Set deleted"
msgstr "Preisschema gelöscht"
#: js/twingle_shop.js
msgid "Could not update Twingle Shop"
msgstr "Twingle-Shop konnte nicht aktualisiert werden"
#: managed/Navigation__twingle_configuration.mgd.php
msgid "Twingle API Configuration"
msgstr "Twingle-API-Konfiguration"
@ -1099,6 +1697,37 @@ msgstr ""
" <p><i>Tipp: Sie können diese Felder im TwingleMANAGER aktivieren oder "
"deaktivieren.</i></p>"
#: templates/CRM/Twingle/Form/Profile.hlp
msgid ""
"Enable the processing of orders via Twingle Shop for this profile. The "
"ordered products will then appear as line items in the contribution."
msgstr ""
"Aktiviert die Verarbeitung von Bestellungen über den Twingle-Shop für dieses "
"Profil. Die bestellten Produkte werden als Belegzeilen der Zuwendung "
"erscheinen."
#: templates/CRM/Twingle/Form/Profile.hlp
msgid ""
"If this option is enabled, all Twingle Shop products corresponding to the "
"specified project IDs will be retrieved from Twingle and mapped as price "
"sets and price fields. Each Twingle Shop is mapped as a price set with its "
"products as price fields."
msgstr ""
"Wenn diese Option aktiviert ist, werden alle zur angegebenen Projekt-ID "
"gehörenden Twingle-Shop-Produkte von Twingle abgerufen und als Preisschemata "
"und Preisfelder zugeordnet. Jeder Twingle-Shop wird als ein Preisschema mit "
"seinen Produkten als Preisfelder zugeordnet."
#: templates/CRM/Twingle/Form/Profile.hlp
msgid ""
"This allows you to manually create contributions with the same line items "
"for phone orders, for example, as would be the case for orders placed "
"through the Twingle Shop."
msgstr ""
"Dies ermöglicht das manuelle Erstellen von Zuwendungen mit den gleichen "
"Belegzeilen wie bei Bestellungen über den Twingle-Shop, z. B. für "
"telefonische Bestellungen."
#: templates/CRM/Twingle/Form/Profile.tpl
msgid "General settings"
msgstr "Allgemeine Einstellungen"
@ -1139,6 +1768,11 @@ msgstr "Double-Opt-In für Newsletter"
msgid "Membership Postprocessing"
msgstr "Mitgliedschafts--Nachbearbeitung (Postprocessing)"
#: templates/CRM/Twingle/Form/Profile.tpl
#: templates/CRM/Twingle/Page/Profiles.tpl
msgid "Shop Integration"
msgstr "Shop-Integration"
#: templates/CRM/Twingle/Form/Profile.tpl
msgid "Are you sure you want to reset the default profile?"
msgstr "Möchten Sie wirklich das Standard-Profil zurücksetzen?"
@ -1188,6 +1822,20 @@ msgstr ""
"Transaktions-ID voranzustellen, um Kollisionen mit anderen Transaktions-IDs "
"auszuschließen."
#: templates/CRM/Twingle/Form/Settings.hlp
msgid ""
"If you enable Twingle Shop integration, you can configure Twingle API "
"profiles to include products ordered through Twingle Shop as line items in "
"the created contribution."
msgstr ""
"Mit aktivierter Twingle-Shop-Integration können Twingle-API-Profile so "
"konfiguriert werden, dass über den Twingle-Shop bestellte Produkte als "
"Belegzeilen in der erstellten Zuwendung enthalten sind."
#: templates/CRM/Twingle/Form/Settings.hlp
msgid "Enter your twingle API access key."
msgstr "Geben Sie ihren Zugriffsschlüssel für die Twingle-API ein."
#: templates/CRM/Twingle/Page/Configuration.tpl
msgid "Profiles"
msgstr "Profile"
@ -1224,6 +1872,14 @@ msgstr "Zuletzt verwendet"
msgid "Operations"
msgstr "Operationen"
#: templates/CRM/Twingle/Page/Profiles.tpl
msgid "enabled"
msgstr "aktiviert"
#: templates/CRM/Twingle/Page/Profiles.tpl
msgid "disabled"
msgstr "deaktiviert"
#: templates/CRM/Twingle/Page/Profiles.tpl
msgid "Edit profile %1"
msgstr "Profil %1 bearbeiten"

View file

@ -91,7 +91,7 @@
{/htxt}
{htxt id='id-shop_map_products'}
<p>{ts domain="de.systopia.twingle"}If this option is enabled, all Twingle Shop products corresponding to the specified project IDs will be retrieved from Twingle and mapped as price sets and price fields. Each Twingle Shop is mapped as a price set with its products as price fields.</p>
<p>This allows you to manually create contributions with the same line items for phone orders, for example, as would be the case for orders placed through the Twingle Shop.</p>
<p>{ts domain="de.systopia.twingle"}If this option is enabled, all Twingle Shop products corresponding to the specified project IDs will be retrieved from Twingle and mapped as price sets and price fields. Each Twingle Shop is mapped as a price set with its products as price fields.{/ts}</p>
<p>{ts domain="de.systopia.twingle"}This allows you to manually create contributions with the same line items for phone orders, for example, as would be the case for orders placed through the Twingle Shop.{/ts}</p>
{/htxt}
{/crmScope}

View file

@ -31,3 +31,7 @@
{htxt id='id-twingle_use_shop'}
{ts domain="de.systopia.twingle"}If you enable Twingle Shop integration, you can configure Twingle API profiles to include products ordered through Twingle Shop as line items in the created contribution.{/ts}
{/htxt}
{htxt id='id-twingle_access_key'}
{ts domain="de.systopia.twingle"}Enter your twingle API access key.{/ts}
{/htxt}

View file

@ -89,24 +89,16 @@
<table class="form-layout-compressed">
<tr class="crm-twingle-form-block-use-shop">
<td class="label">{$form.twingle_use_shop.label}&nbsp;&nbsp;<a onclick='CRM.help("{$form.twingle_use_shop.label}", {literal}{"id":"id-{/literal}{$form.twingle_use_shop.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
<td>
{$form.twingle_use_shop.html}
<br />
<span class="description">
{$formElements.twingle_use_shop.description}
</span>
<td class="label">{$form.twingle_use_shop.label}
{help id="id-twingle_use_shop" title=$form.twingle_use_shop.label}
</td>
<td>{$form.twingle_use_shop.html}</td>
</tr>
<tr class="crm-twingle-form-block-access-key twingle-shop-element">
<td class="label">{$form.twingle_access_key.label}&nbsp;&nbsp;<a onclick='CRM.help("{$form.twingle_access_key.label}", {literal}{"id":"id-{/literal}{$form.twingle_access_key.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
<td>
{$form.twingle_access_key.html}
<br />
<span class="description">
{$formElements.twingle_access_key.description}
</span>
<td class="label">{$form.twingle_access_key.label}
{help id="id-twingle_access_key" title=$form.twingle_access_key.label}
</td>
<td>{$form.twingle_access_key.html}</td>
</tr>
</table>

View file

@ -198,25 +198,3 @@ function _twingle_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $parentID) {
}
}
}
/**
* (Delegated) Implements hook_civicrm_entityTypes().
*
* Find any *.entityType.php files, merge their content, and return.
*
* @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
*/
function _twingle_civix_civicrm_entityTypes(&$entityTypes) {
$entityTypes = array_merge($entityTypes, [
'Civi\Twingle\Shop\DAO\TwingleProduct' => [
'name' => 'TwingleProduct',
'class' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'table' => 'civicrm_twingle_product',
],
'Civi\Twingle\Shop\DAO\TwingleShop' => [
'name' => 'TwingleShop',
'class' => 'Civi\Twingle\Shop\DAO\TwingleShop',
'table' => 'civicrm_twingle_shop',
],
]);
}

View file

@ -17,7 +17,7 @@ function twingle_civicrm_pre($op, $objectName, $id, &$params) {
// Create/delete PriceField and PriceFieldValue for TwingleProduct
elseif ($objectName == 'TwingleProduct') {
$twingle_product = new \Civi\Twingle\Shop\BAO\TwingleProduct();
$twingle_product = new CRM_Twingle_BAO_TwingleProduct();
$twingle_product->load($params);
if ($op == 'create' || $op == 'edit') {
$twingle_product->createPriceField();
@ -30,7 +30,7 @@ function twingle_civicrm_pre($op, $objectName, $id, &$params) {
// Create PriceSet for TwingleShop
elseif ($objectName == 'TwingleShop' && ($op == 'create' || $op == 'edit')) {
$twingle_shop = new \Civi\Twingle\Shop\BAO\TwingleShop();
$twingle_shop = new CRM_Twingle_BAO_TwingleShop();
$twingle_shop->load($params);
$twingle_shop->createPriceSet();
$params = $twingle_shop->getAttributes();

View file

@ -4,7 +4,7 @@
return [
[
'name' => 'TwingleProduct',
'class' => 'Civi\Twingle\Shop\DAO\TwingleProduct',
'class' => 'CRM_Twingle_DAO_TwingleProduct',
'table' => 'civicrm_twingle_product',
],
];

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<table>
<base>CRM/Twingle/Shop</base>
<base>CRM/Twingle</base>
<class>TwingleProduct</class>
<name>civicrm_twingle_product</name>
<comment>This table contains the Twingle Product data.</comment>

View file

@ -4,7 +4,7 @@
return [
[
'name' => 'TwingleShop',
'class' => 'Civi\Twingle\Shop\DAO\TwingleShop',
'class' => 'CRM_Twingle_DAO_TwingleShop',
'table' => 'civicrm_twingle_shop',
],
];

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<table>
<base>CRM/Twingle/Shop</base>
<base>CRM/Twingle</base>
<class>TwingleShop</class>
<name>civicrm_twingle_shop</name>
<comment>This table contains the Twingle Shop data. Each Twingle Shop is linked to a corresponding Price Set.</comment>