Page MenuHomePhorge

D2137.1775282345.diff
No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None

D2137.1775282345.diff

diff --git a/src/app/Entitlement.php b/src/app/Entitlement.php
--- a/src/app/Entitlement.php
+++ b/src/app/Entitlement.php
@@ -81,14 +81,16 @@
*
* @return string The transaction ID
*/
- public function createTransaction($type, $amount = null)
+ public function createTransaction($type, $amount = null, $period_start = null, $period_end = null)
{
$transaction = \App\Transaction::create(
[
'object_id' => $this->id,
'object_type' => \App\Entitlement::class,
'type' => $type,
- 'amount' => $amount
+ 'amount' => $amount,
+ 'period_start' => $period_start,
+ 'period_end' => $period_end
]
);
diff --git a/src/app/Http/Controllers/API/V4/WalletsController.php b/src/app/Http/Controllers/API/V4/WalletsController.php
--- a/src/app/Http/Controllers/API/V4/WalletsController.php
+++ b/src/app/Http/Controllers/API/V4/WalletsController.php
@@ -257,6 +257,8 @@
'createdAt' => $item->created_at->format('Y-m-d H:i'),
'type' => $item->type,
'description' => $item->shortDescription(),
+ 'period_start' => $item->period_start,
+ 'period_end' => $item->period_end,
'amount' => $amount,
'hasDetails' => !empty($item->cnt),
];
diff --git a/src/app/Transaction.php b/src/app/Transaction.php
--- a/src/app/Transaction.php
+++ b/src/app/Transaction.php
@@ -46,6 +46,9 @@
'amount',
'description',
+ // timespan that was charged for
+ 'period_start',
+ 'period_end',
// parent, for example wallet debit is parent for entitlements charged.
'transaction_id'
diff --git a/src/app/Wallet.php b/src/app/Wallet.php
--- a/src/app/Wallet.php
+++ b/src/app/Wallet.php
@@ -109,9 +109,13 @@
continue;
}
+ $period_start = $entitlement->updated_at->copy();
+
$entitlement->updated_at = $entitlement->updated_at->copy()
->addMonthsWithoutOverflow($diff);
+ $period_end = $entitlement->updated_at->copy();
+
$entitlement->save();
if ($cost == 0) {
@@ -120,7 +124,9 @@
$entitlementTransactions[] = $entitlement->createTransaction(
\App\Transaction::ENTITLEMENT_BILLED,
- $cost
+ $cost,
+ $period_start,
+ $period_end
);
}
}
diff --git a/src/database/migrations/2021_01_14_093842_add_timespan_to_transactions_table.php b/src/database/migrations/2021_01_14_093842_add_timespan_to_transactions_table.php
new file mode 100644
--- /dev/null
+++ b/src/database/migrations/2021_01_14_093842_add_timespan_to_transactions_table.php
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddTimespanToTransactionsTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('transactions', function (Blueprint $table) {
+ $table->dateTimeTz('period_start')->nullable(true);
+ $table->dateTimeTz('period_end')->nullable(true);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('transactions', function (Blueprint $table) {
+ //
+ });
+ }
+}
diff --git a/src/resources/themes/kolabnow b/src/resources/themes/kolabnow
new file mode 160000
--- /dev/null
+++ b/src/resources/themes/kolabnow
@@ -0,0 +1 @@
+Subproject commit 02d736bfbd6b19e9d6957eaf0fa4887b6d0f7589
diff --git a/src/resources/vue/Widgets/TransactionLog.vue b/src/resources/vue/Widgets/TransactionLog.vue
--- a/src/resources/vue/Widgets/TransactionLog.vue
+++ b/src/resources/vue/Widgets/TransactionLog.vue
@@ -111,8 +111,15 @@
description(transaction) {
let desc = transaction.description
+ if(transaction.period_start && transaction.period_end) {
+ let from = new Date(transaction.period_start)
+ let till = new Date(transaction.period_end)
+
+ desc += ' (' + from.toLocaleDateString() + ' - ' + till.toLocaleDateString() + ')'
+ }
+
if (/^(billed|created|deleted)$/.test(transaction.type)) {
- desc += ' (' + this.$root.price(transaction.amount) + ')'
+ desc += ' (' + this.$root.price(transaction.amount) +')'
}
return desc

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 4, 5:59 AM (6 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826767
Default Alt Text
D2137.1775282345.diff (4 KB)

Event Timeline