Skip to content
Code-Schnipsel Gruppen Projekte
Commit ed68aefb erstellt von Patrick Müller's avatar Patrick Müller
Dateien durchsuchen

feat: Extra-Daten für Mitgliedschafts-Benutzer

Übergeordneter 3a78a21a
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -10,6 +10,14 @@
width: 100%;
}
.quiqqer-memberships-membershipuserhistory-user {
float: left;
}
.quiqqer-memberships-membershipuserhistory-extrabtn {
float: right;
}
.quiqqer-memberships-membershipuserhistory-history-entry {
float: left;
width: 100%;
......
......@@ -6,4 +6,5 @@
{{membershipLabel}}: {{membership}}
</span>
</div>
<div class="quiqqer-memberships-membershipuserhistory-extrabtn"></div>
<div class="quiqqer-memberships-membershipuserhistory-history"></div>
\ No newline at end of file
......@@ -18,6 +18,8 @@
define('package/quiqqer/memberships/bin/controls/users/MembershipUserHistory', [
'qui/controls/Control',
'qui/controls/buttons/Button',
'qui/controls/windows/Confirm',
'qui/controls/loader/Loader',
'package/quiqqer/memberships/bin/MembershipUsers',
......@@ -29,7 +31,7 @@ define('package/quiqqer/memberships/bin/controls/users/MembershipUserHistory', [
'text!package/quiqqer/memberships/bin/controls/users/MembershipUserHistory.html',
'css!package/quiqqer/memberships/bin/controls/users/MembershipUserHistory.css'
], function (QUIControl, QUILoader, MembershipUsersHandler,
], function (QUIControl, QUIButton, QUIConfirm, QUILoader, MembershipUsersHandler,
QUILocale, QUIAjax, Mustache, template) {
"use strict";
......@@ -43,7 +45,8 @@ define('package/quiqqer/memberships/bin/controls/users/MembershipUserHistory', [
Binds: [
'$onInject',
'$onCreate',
'$load'
'$load',
'$showExtraData'
],
options: {
......@@ -142,7 +145,7 @@ define('package/quiqqer/memberships/bin/controls/users/MembershipUserHistory', [
try {
var Message = JSON.decode(Entry.msg);
msg = JSON.stringify(Message, null, 2);
msg = JSON.stringify(Message, null, 2);
} catch (e) {
// nothing, msg is not JSON formatted
}
......@@ -153,6 +156,46 @@ define('package/quiqqer/memberships/bin/controls/users/MembershipUserHistory', [
}).inject(EntryElm);
}
});
if (!Object.getLength(this.$MembershipUser.extraData)) {
return;
}
// extra btn
new QUIButton({
text : QUILocale.get(lg, 'controls.users.membershipuserhistory.btn.extraData'),
textimage: 'fa fa-file',
events : {
onClick: this.$showExtraData
}
}).inject(
this.$Elm.getElement(
'.quiqqer-memberships-membershipuserhistory-extrabtn'
)
);
},
$showExtraData: function () {
var extraData = JSON.stringify(this.$MembershipUser.extraData, null, 2);
new QUIConfirm({
maxHeight : 600,
maxWidth : 600,
'autoclose': true,
'information': '<pre>' + extraData + '</pre>',
'title' : QUILocale.get(lg,
'controls.membershipuserhistory.extraData.popup.title'
),
'texticon' : 'fa fa-file',
'icon' : 'fa fa-file',
cancel_button: false,
ok_button : {
text : 'OK',
textimage: 'icon-ok fa fa-check'
}
}).open();
}
});
});
......@@ -35,6 +35,7 @@
<field type="DATETIME NULL DEFAULT NULL">archiveDate</field>
<field type="VARCHAR(255) NULL">archiveReason</field>
<field type="MEDIUMTEXT NULL">history</field>
<field type="MEDIUMTEXT NULL">extraData</field>
</table>
</global>
......
......@@ -539,10 +539,22 @@
<de><![CDATA[Aufhebung der Kündigung durch Administrator]]></de>
<en><![CDATA[Revocation of termination by administrator]]></en>
</locale>
<locale name="controls.users.membershipuserhistory.entry.type.misc">
<de><![CDATA[Sonstige Information]]></de>
<en><![CDATA[Miscellaneous information]]></en>
</locale>
<locale name="controls.users.membershipuserhistory.entry.type.cancel_abort">
<de><![CDATA[Kündigung zurückgezogen]]></de>
<en><![CDATA[Cancellation withdrawn]]></en>
</locale>
<locale name="controls.users.membershipuserhistory.btn.extraData">
<de><![CDATA[Extra-Daten]]></de>
<en><![CDATA[Extra data]]></en>
</locale>
<locale name="controls.membershipuserhistory.extraData.popup.title">
<de><![CDATA[Extra-Daten]]></de>
<en><![CDATA[Extra data]]></en>
</locale>
<!-- Control: users/MembershipUserHistoryPopup -->
<locale name="controls.users.membershipuserhistorypopup.title">
......@@ -924,8 +936,8 @@
<en><![CDATA[Product title]]></en>
</locale>
<locale name="controls.products.membershipprouducts.create.popup.information" html="true">
<de><![CDATA[Sind Sie sicher, dass sie ein neues Produkt für die Mitgliedschaft <b>[title]</b> erstellen möchten?]]></de>
<en><![CDATA[Are you sure you want to create new product for the membership <b>[title]</b>?]]></en>
<de><![CDATA[Sind Sie sicher, dass sie ein neues Produkt für die Mitgliedschaft <b>[title]</b> erstellen möchten? Der Titel und die Kurzbeschreibung dieser Mitgliedschaft werden automatisch für das Produkt übernommen.]]></de>
<en><![CDATA[Are you sure you want to create new product for the membership <b>[title]</b>? Title and short description of this membership will be set automatically to the product.]]></en>
</locale>
<locale name="controls.products.membershipprouducts.create.popup.title">
<de><![CDATA[Neues Produkt erstellen]]></de>
......
......@@ -13,6 +13,8 @@
/**
* Class MembershipField
*
* This field represents the assignment of a Membership to a Product
*
* @author www.pcsg.de (Patrick Müller)
*/
class MembershipField extends Products\Field\Field
......@@ -87,41 +89,4 @@ public function getJavaScriptControl()
{
return 'package/quiqqer/memberships/bin/controls/products/MembershipField';
}
/**
* Return the view
*
* @return \QUI\ERP\Products\Field\View
*/
public function getFrontendView()
{
return new FieldFrontendView($this->getFieldDataForView());
}
// /**
// * Return the field data for a view
// *
// * @return array
// */
// protected function getFieldDataForView()
// {
// $attributes = $this->getAttributes();
//
// $tags = $this->getValue();
// $viewTags = array();
//
// foreach ($tags as $lang => $langTags) {
// if (!isset($viewTags[$lang])) {
// $viewTags[$lang] = array();
// }
//
// foreach ($langTags as $tagData) {
// $viewTags[$lang][] = $tagData['tag'];
// }
// }
//
// $attributes['value'] = $viewTags;
//
// return $attributes;
// }
}
......@@ -7,6 +7,11 @@
use QUI\Verification\Verifier;
use QUI;
/**
* Class CancelVerification
*
* Verification process for MembershipUser cancellation by frontend user
*/
class CancelVerification implements VerificationInterface
{
/**
......
......@@ -23,6 +23,7 @@ class Handler extends Factory
const HISTORY_TYPE_DELETED = 'deleted';
const HISTORY_TYPE_ARCHIVED = 'archived';
const HISTORY_TYPE_EXTENDED = 'extended';
const HISTORY_TYPE_MISC = 'misc';
const ARCHIVE_REASON_CANCELLED = 'cancelled';
const ARCHIVE_REASON_EXPIRED = 'expired';
......@@ -224,7 +225,8 @@ public function getChildAttributes()
'cancelDate',
'cancelled',
'archiveReason',
'archiveDate'
'archiveDate',
'extraData'
);
}
......
......@@ -114,7 +114,8 @@ protected function sendAutoExtendMail()
}
$subject = $this->getUser()->getLocale()->get(
'quiqqer/memberships', 'templates.mail.autoextend.subject'
'quiqqer/memberships',
'templates.mail.autoextend.subject'
);
$this->sendMail($subject, dirname(__FILE__, 5) . '/templates/mail_autoextend.html');
......@@ -137,7 +138,8 @@ public function sendManualExtendMail()
}
$subject = $this->getUser()->getLocale()->get(
'quiqqer/memberships', 'templates.mail.manualextend.subject'
'quiqqer/memberships',
'templates.mail.manualextend.subject'
);
$this->sendMail($subject, dirname(__FILE__, 5) . '/templates/mail_manualextend.html');
......@@ -440,13 +442,7 @@ public function getUser()
*/
public function addHistoryEntry($type, $msg = "")
{
$history = $this->getAttribute('history');
if (empty($history)) {
$history = array();
} else {
$history = json_decode($history, true);
}
$history = $this->getHistory();
if (empty($msg)) {
$msg = "";
......@@ -578,7 +574,8 @@ public function getBackendViewData()
'archived' => $this->isArchived(),
'archiveReason' => $this->getAttribute('archiveReason'),
'archiveDate' => $this->getAttribute('archiveDate'),
'cancelled' => $this->isCancelled()
'cancelled' => $this->isCancelled(),
'extraData' => $this->getExtraData()
);
}
......@@ -634,4 +631,61 @@ protected function sendMail($subject, $templateFile, $templateVars = array())
$Mailer->setBody($template);
$Mailer->send();
}
/**
* Set any extra text data to the MembershipUser
*
* This is meant for extra information that is not already covered by the history.
*
* @param string $key
* @param string $value
*/
public function setExtraData($key, $value)
{
$extraData = $this->getExtraData();
$User = QUI::getUserBySession();
$userString = $User->getUsername() . ' (' . $User->getId() . ')';
$editString = Utils::getFormattedTimestamp() . ' - ' . $userString;
if (isset($extraData[$key])) {
$extraData[$key]['edit'] = $editString;
$extraData[$key]['value'] = $value;
} else {
$extraData[$key] = array(
'value' => $value,
'add' => $editString,
'edit' => '-'
);
}
$this->setAttribute('extraData', json_encode($extraData));
}
/**
* Get extra data of this MembershipUser
*
* @param string $key (optional) - If omitted return all extra data
* @return array|string|false
*/
public function getExtraData($key = null)
{
$extraData = $this->getAttribute('extraData');
if (empty($extraData)) {
$extraData = array();
} else {
$extraData = json_decode($extraData, true);
}
if (is_null($key)) {
return $extraData;
}
if (!array_key_exists($key, $extraData)) {
return false;
}
return $extraData[$key]['value'];
}
}
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren