From b0296a02e0328ac7dcf680c885285ce1878b6a59 Mon Sep 17 00:00:00 2001
From: naresh verma
Date: Tue, 9 Apr 2019 17:04:20 +0530
Subject: [PATCH 1/4] inventory source mail
---
config/debugbar.php | 2 +-
config/excel.php | 96 ++++++++++--
config/tinker.php | 4 +-
config/translatable.php | 18 ++-
config/trustedproxy.php | 15 +-
packages/Webkul/Admin/src/Listeners/Order.php | 5 +-
.../Mail/NewInventorySourceNotification.php | 51 ++++++
.../Webkul/Shop/src/Resources/lang/en/app.php | 5 +-
.../new-inventorysource-shipment.blade.php | 145 ++++++++++++++++++
.../views/emails/sales/new-shipment.blade.php | 65 ++++----
10 files changed, 347 insertions(+), 59 deletions(-)
create mode 100644 packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php
create mode 100644 packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php
diff --git a/config/debugbar.php b/config/debugbar.php
index c7c9ceee3..72ccd7bd3 100755
--- a/config/debugbar.php
+++ b/config/debugbar.php
@@ -143,7 +143,7 @@ return [
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
- 'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
+ 'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
diff --git a/config/excel.php b/config/excel.php
index af3e8bb99..37695184f 100755
--- a/config/excel.php
+++ b/config/excel.php
@@ -3,6 +3,7 @@
use Maatwebsite\Excel\Excel;
return [
+
'exports' => [
/*
@@ -16,17 +17,6 @@ return [
*/
'chunk_size' => 1000,
- /*
- |--------------------------------------------------------------------------
- | Temporary path
- |--------------------------------------------------------------------------
- |
- | When exporting files, we use a temporary file, before storing
- | or downloading. Here you can customize that path.
- |
- */
- 'temp_path' => sys_get_temp_dir(),
-
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
@@ -69,6 +59,23 @@ return [
*/
'formatter' => 'slug',
],
+
+ /*
+ |--------------------------------------------------------------------------
+ | CSV Settings
+ |--------------------------------------------------------------------------
+ |
+ | Configure e.g. delimiter, enclosure and line ending for CSV imports.
+ |
+ */
+ 'csv' => [
+ 'delimiter' => ',',
+ 'enclosure' => '"',
+ 'line_ending' => PHP_EOL,
+ 'use_bom' => false,
+ 'include_separator_line' => false,
+ 'excel_compatibility' => false,
+ ],
],
/*
@@ -109,4 +116,71 @@ return [
*/
'pdf' => Excel::DOMPDF,
],
+
+ 'value_binder' => [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Default Value Binder
+ |--------------------------------------------------------------------------
+ |
+ | PhpSpreadsheet offers a way to hook into the process of a value being
+ | written to a cell. In there some assumptions are made on how the
+ | value should be formatted. If you want to change those defaults,
+ | you can implement your own default value binder.
+ |
+ */
+ 'default' => Maatwebsite\Excel\DefaultValueBinder::class,
+ ],
+
+ 'transactions' => [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Transaction Handler
+ |--------------------------------------------------------------------------
+ |
+ | By default the import is wrapped in a transaction. This is useful
+ | for when an import may fail and you want to retry it. With the
+ | transactions, the previous import gets rolled-back.
+ |
+ | You can disable the transaction handler by setting this to null.
+ | Or you can choose a custom made transaction handler here.
+ |
+ | Supported handlers: null|db
+ |
+ */
+ 'handler' => 'db',
+ ],
+
+ 'temporary_files' => [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Local Temporary Path
+ |--------------------------------------------------------------------------
+ |
+ | When exporting and importing files, we use a temporary file, before
+ | storing reading or downloading. Here you can customize that path.
+ |
+ */
+ 'local_path' => sys_get_temp_dir(),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Remote Temporary Disk
+ |--------------------------------------------------------------------------
+ |
+ | When dealing with a multi server setup with queues in which you
+ | cannot rely on having a shared local temporary path, you might
+ | want to store the temporary file on a shared disk. During the
+ | queue executing, we'll retrieve the temporary file from that
+ | location instead. When left to null, it will always use
+ | the local path. This setting only has effect when using
+ | in conjunction with queued imports and exports.
+ |
+ */
+ 'remote_disk' => null,
+
+ ],
];
diff --git a/config/tinker.php b/config/tinker.php
index 181f0fdbd..0d2bf00e7 100755
--- a/config/tinker.php
+++ b/config/tinker.php
@@ -28,6 +28,8 @@ return [
|
*/
- 'dont_alias' => [],
+ 'dont_alias' => [
+ 'App\Nova',
+ ],
];
diff --git a/config/translatable.php b/config/translatable.php
index 17bf04aac..87f898b4e 100755
--- a/config/translatable.php
+++ b/config/translatable.php
@@ -39,6 +39,8 @@ return [
| As a default locale, Translatable takes the locale of Laravel's
| translator. If for some reason you want to override this,
| you can specify what default should be used here.
+ | If you set a value here it will only use the current config value
+ | and never fallback to the translator one.
|
*/
'locale' => null,
@@ -54,7 +56,7 @@ return [
| $useTranslationFallback when defined
|
*/
- 'use_fallback' => true,
+ 'use_fallback' => false,
/*
|--------------------------------------------------------------------------
@@ -80,6 +82,18 @@ return [
*/
'fallback_locale' => 'en',
+ /*
+ |--------------------------------------------------------------------------
+ | Translation Model Namespace
+ |--------------------------------------------------------------------------
+ |
+ | Defines the default 'Translation' class namespace. For example, if
+ | you want to use App\Translations\CountryTranslation instead of App\CountryTranslation
+ | set this to 'App\Translations'.
+ |
+ */
+ 'translation_model_namespace' => null,
+
/*
|--------------------------------------------------------------------------
| Translation Suffix
@@ -113,4 +127,4 @@ return [
|
*/
'to_array_always_loads_translations' => true,
-];
\ No newline at end of file
+];
diff --git a/config/trustedproxy.php b/config/trustedproxy.php
index acda8d51a..e242b0da5 100755
--- a/config/trustedproxy.php
+++ b/config/trustedproxy.php
@@ -15,19 +15,20 @@ return [
* of your proxy (e.g. if using ELB or similar).
*
*/
- 'proxies' => null, // [,], '*'
+ 'proxies' => null, // [,], '*', ','
/*
* To trust one or more specific proxies that connect
- * directly to your server, use an array of IP addresses:
+ * directly to your server, use an array or a string separated by comma of IP addresses:
*/
- # 'proxies' => ['192.168.1.1'],
+ // 'proxies' => ['192.168.1.1'],
+ // 'proxies' => '192.168.1.1, 192.168.1.2',
/*
* Or, to trust all proxies that connect
* directly to your server, use a "*"
*/
- # 'proxies' => '*',
+ // 'proxies' => '*',
/*
* Which headers to use to detect proxy related data (For, Host, Proto, Port)
@@ -36,10 +37,14 @@ return [
*
* - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust)
* - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust)
+ * - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer)
+ *
+ * - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust)
+ * - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust)
+ * - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer)
*
* @link https://symfony.com/doc/current/deployment/proxies.html
*/
'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_ALL,
-
];
diff --git a/packages/Webkul/Admin/src/Listeners/Order.php b/packages/Webkul/Admin/src/Listeners/Order.php
index 377b4fbdd..bd4df32cc 100755
--- a/packages/Webkul/Admin/src/Listeners/Order.php
+++ b/packages/Webkul/Admin/src/Listeners/Order.php
@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Mail;
use Webkul\Admin\Mail\NewOrderNotification;
use Webkul\Admin\Mail\NewInvoiceNotification;
use Webkul\Admin\Mail\NewShipmentNotification;
+use Webkul\Admin\Mail\NewInventorySourceNotification;
/**
* Order event handler
@@ -18,7 +19,7 @@ class Order {
/**
* @param mixed $order
*
- * Send new order confirmation mail to the customer
+ * Send new shipment mail to the customer and inventory source
*/
public function sendNewOrderMail($order)
{
@@ -52,6 +53,8 @@ class Order {
{
try {
Mail::send(new NewShipmentNotification($shipment));
+
+ Mail::send(new NewInventorySourceNotification($shipment));
} catch (\Exception $e) {
}
diff --git a/packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php b/packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php
new file mode 100644
index 000000000..7fda9cd25
--- /dev/null
+++ b/packages/Webkul/Admin/src/Mail/NewInventorySourceNotification.php
@@ -0,0 +1,51 @@
+
+ * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
+ */
+class NewInventorySourceNotification extends Mailable
+{
+ use Queueable, SerializesModels;
+
+ /**
+ * The shipment instance.
+ *
+ * @var Shipment
+ */
+ public $shipment;
+
+ /**
+ * Create a new message instance.
+ *
+ * @param mixed $shipment
+ * @return void
+ */
+ public function __construct($shipment)
+ {
+ $this->shipment = $shipment;
+ }
+
+ /**
+ * Build the message.
+ *
+ * @return $this
+ */
+ public function build()
+ { $order = $this->shipment->order;
+ $inventory = $this->shipment->inventory_source;
+
+ return $this->to($inventory->contact_email, $inventory->name)
+ ->subject(trans('shop::app.mail.shipment.subject', ['order_id' => $order->id]))
+ ->view('shop::emails.sales.new-inventorysource-shipment');
+ }
+}
diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php
index 5eea36989..759572152 100755
--- a/packages/Webkul/Shop/src/Resources/lang/en/app.php
+++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php
@@ -479,11 +479,12 @@ return [
'summary' => 'Summary of Invoice',
],
'shipment' => [
- 'heading' => 'Your Shipment #:shipment_id for Order #:order_id',
+ 'heading' => 'Shipment #:shipment_id has been generated for Order #:order_id',
'subject' => 'Shipment for your order #:order_id',
'summary' => 'Summary of Shipment',
'carrier' => 'Carrier',
- 'tracking-number' => 'Tracking Number'
+ 'tracking-number' => 'Tracking Number',
+ 'greeting' => 'An Order :order_id has been placed on :created_at',
],
'forget-password' => [
'dear' => 'Dear :name',
diff --git a/packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php
new file mode 100644
index 000000000..1b86b2525
--- /dev/null
+++ b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php
@@ -0,0 +1,145 @@
+@component('shop::emails.layouts.master')
+
From 642ef2b1c15b37914803419a1fa2b5f1b4ba167f Mon Sep 17 00:00:00 2001
From: naresh verma
Date: Tue, 9 Apr 2019 17:23:37 +0530
Subject: [PATCH 2/4] reverting config changes
---
config/debugbar.php | 8 ++--
config/excel.php | 98 +++++------------------------------------
config/tinker.php | 6 +--
config/translatable.php | 18 +-------
config/trustedproxy.php | 21 ++++-----
5 files changed, 28 insertions(+), 123 deletions(-)
diff --git a/config/debugbar.php b/config/debugbar.php
index 72ccd7bd3..d5a8dbd67 100755
--- a/config/debugbar.php
+++ b/config/debugbar.php
@@ -9,7 +9,7 @@ return [
|
| Debugbar is enabled by default, when debug is set to true in app.php.
| You can override the value by setting enable to true or false instead of null.
- |
+ |
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
*/
@@ -79,7 +79,7 @@ return [
|
*/
'error_handler' => false,
-
+
/*
|--------------------------------------------------------------------------
| Clockwork integration
@@ -143,7 +143,7 @@ return [
'timeline' => false, // Add the queries to the timeline
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
- 'types' => ['SELECT'], // // workaround ['SELECT'] only. https://github.com/barryvdh/laravel-debugbar/issues/888 ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
+ 'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
@@ -198,4 +198,4 @@ return [
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
-];
+];
\ No newline at end of file
diff --git a/config/excel.php b/config/excel.php
index 37695184f..28cf95fd1 100755
--- a/config/excel.php
+++ b/config/excel.php
@@ -3,7 +3,6 @@
use Maatwebsite\Excel\Excel;
return [
-
'exports' => [
/*
@@ -17,6 +16,17 @@ return [
*/
'chunk_size' => 1000,
+ /*
+ |--------------------------------------------------------------------------
+ | Temporary path
+ |--------------------------------------------------------------------------
+ |
+ | When exporting files, we use a temporary file, before storing
+ | or downloading. Here you can customize that path.
+ |
+ */
+ 'temp_path' => sys_get_temp_dir(),
+
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
@@ -59,23 +69,6 @@ return [
*/
'formatter' => 'slug',
],
-
- /*
- |--------------------------------------------------------------------------
- | CSV Settings
- |--------------------------------------------------------------------------
- |
- | Configure e.g. delimiter, enclosure and line ending for CSV imports.
- |
- */
- 'csv' => [
- 'delimiter' => ',',
- 'enclosure' => '"',
- 'line_ending' => PHP_EOL,
- 'use_bom' => false,
- 'include_separator_line' => false,
- 'excel_compatibility' => false,
- ],
],
/*
@@ -116,71 +109,4 @@ return [
*/
'pdf' => Excel::DOMPDF,
],
-
- 'value_binder' => [
-
- /*
- |--------------------------------------------------------------------------
- | Default Value Binder
- |--------------------------------------------------------------------------
- |
- | PhpSpreadsheet offers a way to hook into the process of a value being
- | written to a cell. In there some assumptions are made on how the
- | value should be formatted. If you want to change those defaults,
- | you can implement your own default value binder.
- |
- */
- 'default' => Maatwebsite\Excel\DefaultValueBinder::class,
- ],
-
- 'transactions' => [
-
- /*
- |--------------------------------------------------------------------------
- | Transaction Handler
- |--------------------------------------------------------------------------
- |
- | By default the import is wrapped in a transaction. This is useful
- | for when an import may fail and you want to retry it. With the
- | transactions, the previous import gets rolled-back.
- |
- | You can disable the transaction handler by setting this to null.
- | Or you can choose a custom made transaction handler here.
- |
- | Supported handlers: null|db
- |
- */
- 'handler' => 'db',
- ],
-
- 'temporary_files' => [
-
- /*
- |--------------------------------------------------------------------------
- | Local Temporary Path
- |--------------------------------------------------------------------------
- |
- | When exporting and importing files, we use a temporary file, before
- | storing reading or downloading. Here you can customize that path.
- |
- */
- 'local_path' => sys_get_temp_dir(),
-
- /*
- |--------------------------------------------------------------------------
- | Remote Temporary Disk
- |--------------------------------------------------------------------------
- |
- | When dealing with a multi server setup with queues in which you
- | cannot rely on having a shared local temporary path, you might
- | want to store the temporary file on a shared disk. During the
- | queue executing, we'll retrieve the temporary file from that
- | location instead. When left to null, it will always use
- | the local path. This setting only has effect when using
- | in conjunction with queued imports and exports.
- |
- */
- 'remote_disk' => null,
-
- ],
-];
+];
\ No newline at end of file
diff --git a/config/tinker.php b/config/tinker.php
index 0d2bf00e7..f8e4b58b1 100755
--- a/config/tinker.php
+++ b/config/tinker.php
@@ -28,8 +28,6 @@ return [
|
*/
- 'dont_alias' => [
- 'App\Nova',
- ],
+ 'dont_alias' => [],
-];
+];
\ No newline at end of file
diff --git a/config/translatable.php b/config/translatable.php
index 87f898b4e..17bf04aac 100755
--- a/config/translatable.php
+++ b/config/translatable.php
@@ -39,8 +39,6 @@ return [
| As a default locale, Translatable takes the locale of Laravel's
| translator. If for some reason you want to override this,
| you can specify what default should be used here.
- | If you set a value here it will only use the current config value
- | and never fallback to the translator one.
|
*/
'locale' => null,
@@ -56,7 +54,7 @@ return [
| $useTranslationFallback when defined
|
*/
- 'use_fallback' => false,
+ 'use_fallback' => true,
/*
|--------------------------------------------------------------------------
@@ -82,18 +80,6 @@ return [
*/
'fallback_locale' => 'en',
- /*
- |--------------------------------------------------------------------------
- | Translation Model Namespace
- |--------------------------------------------------------------------------
- |
- | Defines the default 'Translation' class namespace. For example, if
- | you want to use App\Translations\CountryTranslation instead of App\CountryTranslation
- | set this to 'App\Translations'.
- |
- */
- 'translation_model_namespace' => null,
-
/*
|--------------------------------------------------------------------------
| Translation Suffix
@@ -127,4 +113,4 @@ return [
|
*/
'to_array_always_loads_translations' => true,
-];
+];
\ No newline at end of file
diff --git a/config/trustedproxy.php b/config/trustedproxy.php
index e242b0da5..6f8257058 100755
--- a/config/trustedproxy.php
+++ b/config/trustedproxy.php
@@ -15,36 +15,31 @@ return [
* of your proxy (e.g. if using ELB or similar).
*
*/
- 'proxies' => null, // [,], '*', ','
+ 'proxies' => null, // [,], '*'
/*
* To trust one or more specific proxies that connect
- * directly to your server, use an array or a string separated by comma of IP addresses:
+ * directly to your server, use an array of IP addresses:
*/
- // 'proxies' => ['192.168.1.1'],
- // 'proxies' => '192.168.1.1, 192.168.1.2',
+ # 'proxies' => ['192.168.1.1'],
/*
* Or, to trust all proxies that connect
* directly to your server, use a "*"
*/
- // 'proxies' => '*',
+ # 'proxies' => '*',
/*
* Which headers to use to detect proxy related data (For, Host, Proto, Port)
- *
+ *
* Options include:
- *
+ *
* - Illuminate\Http\Request::HEADER_X_FORWARDED_ALL (use all x-forwarded-* headers to establish trust)
* - Illuminate\Http\Request::HEADER_FORWARDED (use the FORWARDED header to establish trust)
- * - Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB (If you are using AWS Elastic Load Balancer)
*
- * - 'HEADER_X_FORWARDED_ALL' (use all x-forwarded-* headers to establish trust)
- * - 'HEADER_FORWARDED' (use the FORWARDED header to establish trust)
- * - 'HEADER_X_FORWARDED_AWS_ELB' (If you are using AWS Elastic Load Balancer)
- *
* @link https://symfony.com/doc/current/deployment/proxies.html
*/
'headers' => Illuminate\Http\Request::HEADER_X_FORWARDED_ALL,
-];
+
+];
\ No newline at end of file
From ab4c054292458e96cca95a0ea9a8ced89f8c8603 Mon Sep 17 00:00:00 2001
From: naresh verma
Date: Tue, 9 Apr 2019 18:52:44 +0530
Subject: [PATCH 3/4] changed shipment table
---
packages/Webkul/Shop/src/Resources/lang/en/app.php | 1 +
.../sales/new-inventorysource-shipment.blade.php | 10 +++++++++-
.../Resources/views/emails/sales/new-order.blade.php | 12 ++++++------
.../views/emails/sales/new-shipment.blade.php | 9 +++++++++
4 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/packages/Webkul/Shop/src/Resources/lang/en/app.php b/packages/Webkul/Shop/src/Resources/lang/en/app.php
index 759572152..d091218cc 100755
--- a/packages/Webkul/Shop/src/Resources/lang/en/app.php
+++ b/packages/Webkul/Shop/src/Resources/lang/en/app.php
@@ -480,6 +480,7 @@ return [
],
'shipment' => [
'heading' => 'Shipment #:shipment_id has been generated for Order #:order_id',
+ 'inventory-heading' => 'New Shipment #:shipment_id had been generated for Order #:order_id',
'subject' => 'Shipment for your order #:order_id',
'summary' => 'Summary of Shipment',
'carrier' => 'Carrier',
diff --git a/packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php
index 1b86b2525..0ba591f6d 100644
--- a/packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php
+++ b/packages/Webkul/Shop/src/Resources/views/emails/sales/new-inventorysource-shipment.blade.php
@@ -11,7 +11,7 @@