Merge branch 'master' of github.com:akaunting/akaunting into 2.1-dev
This commit is contained in:
		| @@ -34,6 +34,7 @@ abstract class BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download' | ||||
|         ], | ||||
|     ]; | ||||
|  | ||||
|   | ||||
| @@ -15,11 +15,15 @@ class Items extends BulkAction | ||||
|         'enable' => [ | ||||
|             'name' => 'general.enable', | ||||
|             'message' => 'bulk_actions.message.enable', | ||||
|             'path' =>  ['group' => 'common', 'type' => 'items'], | ||||
|             'type' => '*', | ||||
|             'permission' => 'update-common-items', | ||||
|         ], | ||||
|         'disable' => [ | ||||
|             'name' => 'general.disable', | ||||
|             'message' => 'bulk_actions.message.disable', | ||||
|             'path' =>  ['group' => 'common', 'type' => 'items'], | ||||
|             'type' => '*', | ||||
|             'permission' => 'update-common-items', | ||||
|         ], | ||||
|         'delete' => [ | ||||
| @@ -30,6 +34,7 @@ class Items extends BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download', | ||||
|         ], | ||||
|     ]; | ||||
|  | ||||
|   | ||||
| @@ -33,6 +33,7 @@ class Bills extends BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download', | ||||
|         ], | ||||
|     ]; | ||||
|  | ||||
|   | ||||
| @@ -14,6 +14,7 @@ class Payments extends BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download', | ||||
|         ], | ||||
|         'delete' => [ | ||||
|             'name' => 'general.delete', | ||||
|   | ||||
| @@ -29,6 +29,7 @@ class Vendors extends BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download', | ||||
|         ], | ||||
|     ]; | ||||
|  | ||||
|   | ||||
| @@ -29,6 +29,7 @@ class Customers extends BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download', | ||||
|         ], | ||||
|     ]; | ||||
|  | ||||
|   | ||||
| @@ -39,6 +39,7 @@ class Invoices extends BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download', | ||||
|         ], | ||||
|     ]; | ||||
|  | ||||
|   | ||||
| @@ -19,6 +19,7 @@ class Revenues extends BulkAction | ||||
|         'export' => [ | ||||
|             'name' => 'general.export', | ||||
|             'message' => 'bulk_actions.message.export', | ||||
|             'type' => 'download', | ||||
|         ], | ||||
|     ]; | ||||
|  | ||||
|   | ||||
							
								
								
									
										22
									
								
								app/Events/Common/BulkActionsAdding.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/Events/Common/BulkActionsAdding.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Events\Common; | ||||
|  | ||||
| use Illuminate\Queue\SerializesModels; | ||||
|  | ||||
| class BulkActionsAdding | ||||
| { | ||||
|     use SerializesModels; | ||||
|  | ||||
|     public $bulk_action; | ||||
|  | ||||
|     /** | ||||
|      * Create a new event instance. | ||||
|      * | ||||
|      * @param $bulk_action | ||||
|      */ | ||||
|     public function __construct($bulk_action) | ||||
|     { | ||||
|         $this->bulk_action = $bulk_action; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										22
									
								
								app/Events/Common/CompanyCreated.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/Events/Common/CompanyCreated.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Events\Common; | ||||
|  | ||||
| use Illuminate\Queue\SerializesModels; | ||||
|  | ||||
| class CompanyCreated | ||||
| { | ||||
|     use SerializesModels; | ||||
|  | ||||
|     public $company; | ||||
|  | ||||
|     /** | ||||
|      * Create a new event instance. | ||||
|      * | ||||
|      * @param $company | ||||
|      */ | ||||
|     public function __construct($company) | ||||
|     { | ||||
|         $this->company = $company; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										22
									
								
								app/Events/Common/CompanyCreating.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								app/Events/Common/CompanyCreating.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Events\Common; | ||||
|  | ||||
| use Illuminate\Queue\SerializesModels; | ||||
|  | ||||
| class CompanyCreating | ||||
| { | ||||
|     use SerializesModels; | ||||
|  | ||||
|     public $request; | ||||
|  | ||||
|     /** | ||||
|      * Create a new event instance. | ||||
|      * | ||||
|      * @param $request | ||||
|      */ | ||||
|     public function __construct($request) | ||||
|     { | ||||
|         $this->request = $request; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										26
									
								
								app/Events/Common/CompanyUpdated.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/Events/Common/CompanyUpdated.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Events\Common; | ||||
|  | ||||
| use Illuminate\Queue\SerializesModels; | ||||
|  | ||||
| class CompanyUpdated | ||||
| { | ||||
|     use SerializesModels; | ||||
|  | ||||
|     public $company; | ||||
|  | ||||
|     public $request; | ||||
|  | ||||
|     /** | ||||
|      * Create a new event instance. | ||||
|      * | ||||
|      * @param $company | ||||
|      * @param $request | ||||
|      */ | ||||
|     public function __construct($company, $request) | ||||
|     { | ||||
|         $this->company = $company; | ||||
|         $this->request = $request; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										26
									
								
								app/Events/Common/CompanyUpdating.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								app/Events/Common/CompanyUpdating.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Events\Common; | ||||
|  | ||||
| use Illuminate\Queue\SerializesModels; | ||||
|  | ||||
| class CompanyUpdating | ||||
| { | ||||
|     use SerializesModels; | ||||
|  | ||||
|     public $company; | ||||
|  | ||||
|     public $request; | ||||
|  | ||||
|     /** | ||||
|      * Create a new event instance. | ||||
|      * | ||||
|      * @param $company | ||||
|      * @param $request | ||||
|      */ | ||||
|     public function __construct($company, $request) | ||||
|     { | ||||
|         $this->company = $company; | ||||
|         $this->request = $request; | ||||
|     } | ||||
| } | ||||
| @@ -52,9 +52,9 @@ class Kernel extends HttpKernel | ||||
|             'api.auth', | ||||
|             'auth.disabled', | ||||
|             'throttle:60,1', | ||||
|             'bindings', | ||||
|             'api.company', | ||||
|             'permission:read-api', | ||||
|             'api.company', | ||||
|             'bindings', | ||||
|             'company.settings', | ||||
|             'company.currencies', | ||||
|             'language', | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
| namespace App\Http\ViewComposers; | ||||
|  | ||||
| use Akaunting\Module\Module; | ||||
| use App\Events\Common\BulkActionsAdding; | ||||
| use Date; | ||||
| use Illuminate\Support\Str; | ||||
| use Illuminate\View\View; | ||||
| @@ -67,10 +68,19 @@ class Index | ||||
|             $class_name = 'App\BulkActions\\' .  $file_name; | ||||
|         } | ||||
|  | ||||
|         if (!class_exists($class_name)) { | ||||
|             return; | ||||
|         if (class_exists($class_name)) { | ||||
|             event(new BulkActionsAdding(app($class_name))); | ||||
|  | ||||
|             $bulk_actions = app($class_name)->actions; | ||||
|         } else { | ||||
|             $b = new \stdClass(); | ||||
|             $b->actions = []; | ||||
|  | ||||
|             event(new BulkActionsAdding($b)); | ||||
|  | ||||
|             $bulk_actions = $b->actions; | ||||
|         } | ||||
|  | ||||
|         $view->with(['bulk_actions' => app($class_name)->actions]); | ||||
|         $view->with(['bulk_actions' => $bulk_actions]); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -3,6 +3,8 @@ | ||||
| namespace App\Jobs\Common; | ||||
|  | ||||
| use App\Abstracts\Job; | ||||
| use App\Events\Common\CompanyCreated; | ||||
| use App\Events\Common\CompanyCreating; | ||||
| use App\Models\Common\Company; | ||||
| use Artisan; | ||||
|  | ||||
| @@ -29,6 +31,8 @@ class CreateCompany extends Job | ||||
|      */ | ||||
|     public function handle() | ||||
|     { | ||||
|         event(new CompanyCreating($this->request)); | ||||
|  | ||||
|         \DB::transaction(function () { | ||||
|             $this->company = Company::create($this->request->all()); | ||||
|  | ||||
| @@ -41,6 +45,8 @@ class CreateCompany extends Job | ||||
|             $this->updateSettings(); | ||||
|         }); | ||||
|  | ||||
|         event(new CompanyCreated($this->company)); | ||||
|  | ||||
|         return $this->company; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -3,6 +3,8 @@ | ||||
| namespace App\Jobs\Common; | ||||
|  | ||||
| use App\Abstracts\Job; | ||||
| use App\Events\Common\CompanyUpdated; | ||||
| use App\Events\Common\CompanyUpdating; | ||||
| use App\Models\Common\Company; | ||||
| use App\Traits\Users; | ||||
|  | ||||
| @@ -35,6 +37,8 @@ class UpdateCompany extends Job | ||||
|     { | ||||
|         $this->authorize(); | ||||
|  | ||||
|         event(new CompanyUpdating($this->company, $this->request)); | ||||
|  | ||||
|         \DB::transaction(function () { | ||||
|             $this->company->update($this->request->all()); | ||||
|  | ||||
| @@ -77,6 +81,8 @@ class UpdateCompany extends Job | ||||
|             setting()->forgetAll(); | ||||
|         }); | ||||
|  | ||||
|         event(new CompanyUpdated($this->company, $this->request)); | ||||
|  | ||||
|         return $this->company; | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -57,7 +57,7 @@ class UpdateBill extends Job | ||||
|             $this->bill->paid_amount = $this->bill->paid; | ||||
|             event(new PaidAmountCalculated($this->bill)); | ||||
|  | ||||
|             if ($this->request['amount'] > $this->bill->paid_amount) { | ||||
|             if ($this->request['amount'] > $this->bill->paid_amount && $this->bill->paid_amount > 0) { | ||||
|                 $this->request['status'] = 'partial'; | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -57,7 +57,7 @@ class UpdateInvoice extends Job | ||||
|             $this->invoice->paid_amount = $this->invoice->paid; | ||||
|             event(new PaidAmountCalculated($this->invoice)); | ||||
|  | ||||
|             if ($this->request['amount'] > $this->invoice->paid_amount) { | ||||
|             if ($this->request['amount'] > $this->invoice->paid_amount && $this->invoice->paid_amount > 0) { | ||||
|                 $this->request['status'] = 'partial'; | ||||
|             } | ||||
|  | ||||
|   | ||||
							
								
								
									
										29
									
								
								app/Listeners/Update/V20/Version2023.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								app/Listeners/Update/V20/Version2023.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Listeners\Update\V20; | ||||
|  | ||||
| use App\Abstracts\Listeners\Update as Listener; | ||||
| use App\Events\Install\UpdateFinished as Event; | ||||
| use Illuminate\Support\Facades\Artisan; | ||||
|  | ||||
| class Version2023 extends Listener | ||||
| { | ||||
|     const ALIAS = 'core'; | ||||
|  | ||||
|     const VERSION = '2.0.23'; | ||||
|  | ||||
|     /** | ||||
|      * Handle the event. | ||||
|      * | ||||
|      * @param  $event | ||||
|      * @return void | ||||
|      */ | ||||
|     public function handle(Event $event) | ||||
|     { | ||||
|         if ($this->skipThisUpdate($event)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Artisan::call('migrate', ['--force' => true]); | ||||
|     } | ||||
| } | ||||
| @@ -23,6 +23,7 @@ class Event extends Provider | ||||
|             'App\Listeners\Update\V20\Version2014', | ||||
|             'App\Listeners\Update\V20\Version2017', | ||||
|             'App\Listeners\Update\V20\Version2020', | ||||
|             'App\Listeners\Update\V20\Version2023', | ||||
|         ], | ||||
|         'Illuminate\Auth\Events\Login' => [ | ||||
|             'App\Listeners\Auth\Login', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user