diff --git a/.env.example b/.env.example index e9f998867..c15b6a8d6 100644 --- a/.env.example +++ b/.env.example @@ -26,3 +26,5 @@ MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null +MAIL_FROM_NAME=null +MAIL_FROM_ADDRESS=null diff --git a/app/Console/Commands/ModuleDelete.php b/app/Console/Commands/ModuleDelete.php new file mode 100644 index 000000000..d2974f08e --- /dev/null +++ b/app/Console/Commands/ModuleDelete.php @@ -0,0 +1,78 @@ +argument('alias'); + $company_id = $this->argument('company_id'); + + $model = Module::alias($alias)->companyId($company_id)->first(); + + if (!$model) { + $this->info("Module [{$alias}] not found."); + return; + } + + $module = $this->laravel['modules']->findByAlias($alias); + $module->delete(); + + $model->status = 0; + $model->save(); + + // Add history + $data = [ + 'company_id' => $company_id, + 'module_id' => $model->id, + 'category' => $module->get('category'), + 'version' => $module->get('version'), + 'description' => trans('modules.deleted', ['module' => $module->get('name')]), + ]; + + ModuleHistory::create($data); + + Artisan::call('cache:clear'); + + $this->info("Module [{$alias}] deleted."); + } + + /** + * Get the console command arguments. + * + * @return array + */ + protected function getArguments() + { + return array( + array('alias', InputArgument::REQUIRED, 'Module alias.'), + array('company_id', InputArgument::REQUIRED, 'Company ID.'), + ); + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d8f35a822..96844ddfc 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -13,10 +13,11 @@ class Kernel extends ConsoleKernel * @var array */ protected $commands = [ - Commands\CompanySeed::class, Commands\BillReminder::class, + Commands\CompanySeed::class, Commands\Install::class, Commands\InvoiceReminder::class, + Commands\ModuleDelete::class, Commands\ModuleDisable::class, Commands\ModuleEnable::class, Commands\ModuleInstall::class, diff --git a/app/Http/Controllers/Expenses/Bills.php b/app/Http/Controllers/Expenses/Bills.php index daf3dc4e1..8855c5536 100644 --- a/app/Http/Controllers/Expenses/Bills.php +++ b/app/Http/Controllers/Expenses/Bills.php @@ -267,7 +267,7 @@ class Bills extends Controller $excel->sheet('bills', function ($sheet) use ($bills) { $sheet->fromModel($bills->makeHidden([ - 'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media' + 'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media', 'paid' ])); }); diff --git a/app/Http/Controllers/Incomes/Invoices.php b/app/Http/Controllers/Incomes/Invoices.php index 28c421963..8a6bf4372 100644 --- a/app/Http/Controllers/Incomes/Invoices.php +++ b/app/Http/Controllers/Incomes/Invoices.php @@ -279,7 +279,7 @@ class Invoices extends Controller $excel->sheet('invoices', function ($sheet) use ($invoices) { $sheet->fromModel($invoices->makeHidden([ - 'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media' + 'company_id', 'parent_id', 'created_at', 'updated_at', 'deleted_at', 'attachment', 'discount', 'items', 'histories', 'payments', 'totals', 'media', 'paid' ])); }); diff --git a/app/Http/Controllers/Reports/TaxSummary.php b/app/Http/Controllers/Reports/TaxSummary.php index fbee9ccc3..1907ac90d 100644 --- a/app/Http/Controllers/Reports/TaxSummary.php +++ b/app/Http/Controllers/Reports/TaxSummary.php @@ -104,7 +104,7 @@ class TaxSummary extends Controller private function setAmount(&$items, &$totals, $rows, $type, $date_field) { foreach ($rows as $row) { - if ($row['table'] == 'bill_payments' || $row['table'] == 'invoice_payments') { + if ($row->getTable() == 'bill_payments' || $row->getTable() == 'invoice_payments') { $type_row = $row->$type; $row->category_id = $type_row->category_id; @@ -127,7 +127,14 @@ class TaxSummary extends Controller continue; } - $amount = $this->convert($row_total->amount, $row->currency_code, $row->currency_rate); + if ($date_field == 'paid_at') { + $rate = ($row->amount * 100) / $type_row->amount; + $row_amount = ($row_total->amount / 100) * $rate; + } else { + $row_amount = $row_total->amount; + } + + $amount = $this->convert($row_amount, $row->currency_code, $row->currency_rate); $items[$row_total->name][$date]['amount'] += $amount; diff --git a/app/Http/Controllers/Settings/Settings.php b/app/Http/Controllers/Settings/Settings.php index 0f3006fd3..873d9c924 100644 --- a/app/Http/Controllers/Settings/Settings.php +++ b/app/Http/Controllers/Settings/Settings.php @@ -181,17 +181,17 @@ class Settings extends Controller protected function oneCompany($key, $value) { switch ($key) { + case 'company_name': + Installer::updateEnv(['MAIL_FROM_NAME' => '"' . $value . '"']); + break; + case 'company_email': + Installer::updateEnv(['MAIL_FROM_ADDRESS' => $value]); + break; case 'default_locale': - // Change default locale - Installer::updateEnv([ - 'APP_LOCALE' => $value - ]); + Installer::updateEnv(['APP_LOCALE' => $value]); break; case 'session_handler': - // Change session handler - Installer::updateEnv([ - 'SESSION_DRIVER' => $value - ]); + Installer::updateEnv(['SESSION_DRIVER' => $value]); break; } } diff --git a/app/Notifications/Auth/Reset.php b/app/Notifications/Auth/Reset.php index 7353221f1..645a2de6b 100644 --- a/app/Notifications/Auth/Reset.php +++ b/app/Notifications/Auth/Reset.php @@ -43,11 +43,9 @@ class Reset extends Notification */ public function toMail($notifiable) { - setting(['general.company_name' => config('app.name')]); - return (new MailMessage) ->line(trans('auth.notification.message_1')) - ->action(trans('auth.notification.button'), url('auth/reset', $this->token, true)) + ->action(trans('auth.notification.button'), url('auth/reset', $this->token)) ->line(trans('auth.notification.message_2')); } } diff --git a/app/Notifications/Common/Item.php b/app/Notifications/Common/Item.php index 09bdd1d52..335ecc1a3 100644 --- a/app/Notifications/Common/Item.php +++ b/app/Notifications/Common/Item.php @@ -45,7 +45,7 @@ class Item extends Notification { $message = (new MailMessage) ->line(trans('items.notification.message.out_of_stock', ['name' => $this->item->name])) - ->action(trans('items.notification.button'), url('items/items', $this->item->id, true)); + ->action(trans('items.notification.button'), url('items/items', $this->item->id)); // Override per company as Laravel doesn't read config $message->from(config('mail.from.address'), config('mail.from.name')); diff --git a/app/Notifications/Common/ItemReminder.php b/app/Notifications/Common/ItemReminder.php index 4aa84dcb9..c8a801582 100644 --- a/app/Notifications/Common/ItemReminder.php +++ b/app/Notifications/Common/ItemReminder.php @@ -45,7 +45,7 @@ class ItemReminder extends Notification { $message = (new MailMessage) ->line(trans('items.notification.message.reminder', ['name' => $this->item->name, 'quantity' => $this->item->quantity])) - ->action(trans('items.notification.button'), url('items/items', $this->item->id, true)); + ->action(trans('items.notification.button'), url('items/items', $this->item->id)); // Override per company as Laravel doesn't read config $message->from(config('mail.from.address'), config('mail.from.name')); diff --git a/app/Notifications/Customer/Invoice.php b/app/Notifications/Customer/Invoice.php index 6e7559ea5..94210f12c 100644 --- a/app/Notifications/Customer/Invoice.php +++ b/app/Notifications/Customer/Invoice.php @@ -62,7 +62,7 @@ class Invoice extends Notification ]); } - $message->action(trans('customers.notification.button'), url('incomes/invoices', $this->invoice->id, true)); + $message->action(trans('customers.notification.button'), url('incomes/invoices', $this->invoice->id)); return $message; } diff --git a/app/Notifications/Expense/Bill.php b/app/Notifications/Expense/Bill.php index 85fa96668..73a751cdd 100644 --- a/app/Notifications/Expense/Bill.php +++ b/app/Notifications/Expense/Bill.php @@ -48,7 +48,7 @@ class Bill extends Notification { $message = (new MailMessage) ->line('You are receiving this email because you have an upcoming ' . money($this->bill->amount, $this->bill->currency_code, true) . ' bill to ' . $this->bill->vendor_name . ' vendor.') - ->action('Add Payment', url('expenses/bills', $this->bill->id, true)); + ->action('Add Payment', url('expenses/bills', $this->bill->id)); // Override per company as Laravel doesn't read config $message->from(config('mail.from.address'), config('mail.from.name')); diff --git a/app/Notifications/Income/Invoice.php b/app/Notifications/Income/Invoice.php index ad6dd01bb..5a06a646a 100644 --- a/app/Notifications/Income/Invoice.php +++ b/app/Notifications/Income/Invoice.php @@ -60,7 +60,7 @@ class Invoice extends Notification } if ($this->invoice->customer->user) { - $message->action(trans('invoices.notification.button'), url('customers/invoices', $this->invoice->id, true)); + $message->action(trans('invoices.notification.button'), url('customers/invoices', $this->invoice->id)); } return $message; diff --git a/app/Utilities/Installer.php b/app/Utilities/Installer.php index 10eed40bc..c9d434b63 100644 --- a/app/Utilities/Installer.php +++ b/app/Utilities/Installer.php @@ -269,16 +269,24 @@ class Installer $env = explode("\n", $env); foreach ($data as $data_key => $data_value) { + $updated = false; + foreach ($env as $env_key => $env_value) { $entry = explode('=', $env_value, 2); // Check if new or old key if ($entry[0] == $data_key) { $env[$env_key] = $data_key . '=' . $data_value; + $updated = true; } else { $env[$env_key] = $env_value; } } + + // Lets create if not available + if (!$updated) { + $env[] = $data_key . '=' . $data_value; + } } $env = implode("\n", $env); diff --git a/composer.lock b/composer.lock index 66c4ef926..c9f61b15c 100644 --- a/composer.lock +++ b/composer.lock @@ -66,16 +66,16 @@ }, { "name": "akaunting/money", - "version": "1.0.6", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/akaunting/money.git", - "reference": "d56221b2cbf4771c50da0c2e0273869cc659ed2e" + "reference": "e5d038fe38f6400261dfff6f7ed0e0a8245719af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akaunting/money/zipball/d56221b2cbf4771c50da0c2e0273869cc659ed2e", - "reference": "d56221b2cbf4771c50da0c2e0273869cc659ed2e", + "url": "https://api.github.com/repos/akaunting/money/zipball/e5d038fe38f6400261dfff6f7ed0e0a8245719af", + "reference": "e5d038fe38f6400261dfff6f7ed0e0a8245719af", "shasum": "" }, "require": { @@ -123,7 +123,7 @@ "laravel", "money" ], - "time": "2018-09-01T11:56:07+00:00" + "time": "2018-11-04T07:12:33+00:00" }, { "name": "akaunting/setting", @@ -2764,16 +2764,16 @@ }, { "name": "monolog/monolog", - "version": "1.23.0", + "version": "1.24.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", "shasum": "" }, "require": { @@ -2838,7 +2838,7 @@ "logging", "psr-3" ], - "time": "2017-06-19T01:22:40+00:00" + "time": "2018-11-05T09:00:11+00:00" }, { "name": "mtdowling/cron-expression", @@ -4209,16 +4209,16 @@ }, { "name": "symfony/class-loader", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", - "reference": "f31333bdff54c7595f834d510a6d2325573ddb36" + "reference": "5605edec7b8f034ead2497ff4aab17bb70d558c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/f31333bdff54c7595f834d510a6d2325573ddb36", - "reference": "f31333bdff54c7595f834d510a6d2325573ddb36", + "url": "https://api.github.com/repos/symfony/class-loader/zipball/5605edec7b8f034ead2497ff4aab17bb70d558c1", + "reference": "5605edec7b8f034ead2497ff4aab17bb70d558c1", "shasum": "" }, "require": { @@ -4261,20 +4261,20 @@ ], "description": "Symfony ClassLoader Component", "homepage": "https://symfony.com", - "time": "2018-10-02T12:28:39+00:00" + "time": "2018-10-31T09:06:03+00:00" }, { "name": "symfony/console", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b" + "reference": "1d228fb4602047d7b26a0554e0d3efd567da5803" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", - "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", + "url": "https://api.github.com/repos/symfony/console/zipball/1d228fb4602047d7b26a0554e0d3efd567da5803", + "reference": "1d228fb4602047d7b26a0554e0d3efd567da5803", "shasum": "" }, "require": { @@ -4330,11 +4330,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-10-02T16:33:53+00:00" + "time": "2018-10-30T16:50:50+00:00" }, { "name": "symfony/css-selector", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -4387,16 +4387,16 @@ }, { "name": "symfony/debug", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6" + "reference": "fe9793af008b651c5441bdeab21ede8172dab097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/0a612e9dfbd2ccce03eb174365f31ecdca930ff6", - "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6", + "url": "https://api.github.com/repos/symfony/debug/zipball/fe9793af008b651c5441bdeab21ede8172dab097", + "reference": "fe9793af008b651c5441bdeab21ede8172dab097", "shasum": "" }, "require": { @@ -4439,20 +4439,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-10-02T16:33:53+00:00" + "time": "2018-10-31T09:06:03+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb" + "reference": "db9e829c8f34c3d35cf37fcd4cdb4293bc4a2f14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", - "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/db9e829c8f34c3d35cf37fcd4cdb4293bc4a2f14", + "reference": "db9e829c8f34c3d35cf37fcd4cdb4293bc4a2f14", "shasum": "" }, "require": { @@ -4502,11 +4502,11 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-07-26T09:06:28+00:00" + "time": "2018-10-30T16:50:50+00:00" }, { "name": "symfony/finder", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -4555,16 +4555,16 @@ }, { "name": "symfony/http-foundation", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3a4498236ade473c52b92d509303e5fd1b211ab1" + "reference": "5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a4498236ade473c52b92d509303e5fd1b211ab1", - "reference": "3a4498236ade473c52b92d509303e5fd1b211ab1", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0", + "reference": "5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0", "shasum": "" }, "require": { @@ -4605,20 +4605,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-10-03T08:48:18+00:00" + "time": "2018-10-31T08:57:11+00:00" }, { "name": "symfony/http-kernel", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "a0944a9a1d8845da724236cde9a310964acadb1c" + "reference": "4bf0be7c7fe63eff6a5eae2f21c83e77e31a56fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a0944a9a1d8845da724236cde9a310964acadb1c", - "reference": "a0944a9a1d8845da724236cde9a310964acadb1c", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/4bf0be7c7fe63eff6a5eae2f21c83e77e31a56fb", + "reference": "4bf0be7c7fe63eff6a5eae2f21c83e77e31a56fb", "shasum": "" }, "require": { @@ -4694,7 +4694,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-10-03T12:03:34+00:00" + "time": "2018-11-03T10:03:02+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4982,16 +4982,16 @@ }, { "name": "symfony/process", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "1dc2977afa7d70f90f3fefbcd84152813558910e" + "reference": "35c2914a9f50519bd207164c353ae4d59182c2cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/1dc2977afa7d70f90f3fefbcd84152813558910e", - "reference": "1dc2977afa7d70f90f3fefbcd84152813558910e", + "url": "https://api.github.com/repos/symfony/process/zipball/35c2914a9f50519bd207164c353ae4d59182c2cb", + "reference": "35c2914a9f50519bd207164c353ae4d59182c2cb", "shasum": "" }, "require": { @@ -5027,11 +5027,11 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-10-02T12:28:39+00:00" + "time": "2018-10-14T17:33:21+00:00" }, { "name": "symfony/routing", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", @@ -5108,7 +5108,7 @@ }, { "name": "symfony/translation", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", @@ -5176,7 +5176,7 @@ }, { "name": "symfony/var-dumper", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", @@ -6608,7 +6608,7 @@ }, { "name": "symfony/yaml", - "version": "v3.4.17", + "version": "v3.4.18", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/config/version.php b/config/version.php index 1bdfcf514..0d65905f7 100644 --- a/config/version.php +++ b/config/version.php @@ -14,11 +14,11 @@ return [ 'build' => '', - 'status' => 'RC 2', + 'status' => 'RC 3', - 'date' => '02-November-2018', + 'date' => '06-November-2018', - 'time' => '18:30', + 'time' => '10:30', 'zone' => 'GMT +3', diff --git a/public/css/app.css b/public/css/app.css index 37cbf2d0b..73e828653 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -770,12 +770,13 @@ input[type="number"] { border-radius: 0; } -#tax-add-new { - padding: 6px 12px; -} - #items .select2-search__field { padding-left: 15px; + margin-top: 6px; +} + +#tax-add-new { + padding: 6px 12px; } .stepwizard-step p { @@ -866,6 +867,10 @@ input[type="number"] { min-height: 30px !important; } +.box-filter .select2-search__field { + font-size: 12px !important; +} + /* App Detail Page Sliders Start */ .row.module #description .img-fluid.d-block.w-100 { height: 420px; diff --git a/resources/views/expenses/bills/index.blade.php b/resources/views/expenses/bills/index.blade.php index 73862c248..426cb7ee0 100644 --- a/resources/views/expenses/bills/index.blade.php +++ b/resources/views/expenses/bills/index.blade.php @@ -48,6 +48,7 @@
@foreach($bills as $item) + @php $paid = $item->paid; @endphp