mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 06:37:33 -05:00 
			
		
		
		
	
						commit
						eda88c6043
					
				@ -1 +1 @@
 | 
				
			|||||||
5.3.96
 | 
					5.3.97
 | 
				
			||||||
@ -108,6 +108,7 @@ class CreateSingleAccount extends Command
 | 
				
			|||||||
            'default_password_timeout' => 30*60000,
 | 
					            'default_password_timeout' => 30*60000,
 | 
				
			||||||
            'portal_mode' => 'domain',
 | 
					            'portal_mode' => 'domain',
 | 
				
			||||||
            'portal_domain' => 'http://ninja.test:8000',
 | 
					            'portal_domain' => 'http://ninja.test:8000',
 | 
				
			||||||
 | 
					            'track_inventory' => true
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $settings = $company->settings;
 | 
					        $settings = $company->settings;
 | 
				
			||||||
 | 
				
			|||||||
@ -61,10 +61,13 @@ class EmailTemplateDefaults
 | 
				
			|||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 'email_template_custom3':
 | 
					            case 'email_template_custom3':
 | 
				
			||||||
                return self::emailInvoiceTemplate();
 | 
					                return self::emailInvoiceTemplate();
 | 
				
			||||||
 | 
					            case 'email_template_purchase_order':
 | 
				
			||||||
 | 
					                return self::emailPurchaseOrderSubject();
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Subject */
 | 
					            /* Subject */
 | 
				
			||||||
 | 
					            case 'email_subject_purchase_order':
 | 
				
			||||||
 | 
					                return self::emailPurchaseOrderSubject();
 | 
				
			||||||
            case 'email_subject_invoice':
 | 
					            case 'email_subject_invoice':
 | 
				
			||||||
                return self::emailInvoiceSubject();
 | 
					                return self::emailInvoiceSubject();
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@ -152,6 +155,20 @@ class EmailTemplateDefaults
 | 
				
			|||||||
        return ctrans('texts.payment_subject');
 | 
					        return ctrans('texts.payment_subject');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static function emailPurchaseOrderSubject()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return ctrans('texts.purchase_order_subject', ['number' => '$number']);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static function emailPurchaseOrderTemplate()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $purchase_order_message = '<p>$vendor<br><br>'.self::transformText('purchase_order_message').'</p><div class="center">$view_button</div>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $purchase_order_message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function emailPaymentTemplate()
 | 
					    public static function emailPaymentTemplate()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $payment_message = '<p>$client<br><br>'.self::transformText('payment_message').'<br><br>$invoices</p><div class="center">$view_button</div>';
 | 
					        $payment_message = '<p>$client<br><br>'.self::transformText('payment_message').'<br><br>$invoices</p><div class="center">$view_button</div>';
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasArchived.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasArchived.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Events\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Class PurchaseOrderWasArchived.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class PurchaseOrderWasArchived
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @var PurchaseOrder
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public $purchase_order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $event_vars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create a new event instance.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param PurchaseOrder $purchase_order
 | 
				
			||||||
 | 
					     * @param Company $company
 | 
				
			||||||
 | 
					     * @param array $event_vars
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(PurchaseOrder $purchase_order, Company $company, array $event_vars)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->purchase_order = $purchase_order;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
 | 
					        $this->event_vars = $event_vars;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasCreated.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasCreated.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Events\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Class PurchaseOrderWasCreated.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class PurchaseOrderWasCreated
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @var PurchaseOrder
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public $purchase_order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $event_vars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create a new event instance.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param PurchaseOrder $purchase_order
 | 
				
			||||||
 | 
					     * @param Company $company
 | 
				
			||||||
 | 
					     * @param array $event_vars
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(PurchaseOrder $purchase_order, Company $company, array $event_vars)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->purchase_order = $purchase_order;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
 | 
					        $this->event_vars = $event_vars;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasDeleted.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasDeleted.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Events\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Class PurchaseOrderWasDeleted.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class PurchaseOrderWasDeleted
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @var PurchaseOrder
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public $purchase_order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $event_vars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create a new event instance.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param PurchaseOrder $purchase_order
 | 
				
			||||||
 | 
					     * @param Company $company
 | 
				
			||||||
 | 
					     * @param array $event_vars
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(PurchaseOrder $purchase_order, Company $company, array $event_vars)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->purchase_order = $purchase_order;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
 | 
					        $this->event_vars = $event_vars;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasEmailed.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasEmailed.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Events\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Class PurchaseOrderWasEmailed.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class PurchaseOrderWasEmailed
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @var PurchaseOrder
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public $purchase_order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $event_vars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create a new event instance.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param PurchaseOrder $purchase_order
 | 
				
			||||||
 | 
					     * @param Company $company
 | 
				
			||||||
 | 
					     * @param array $event_vars
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(PurchaseOrder $purchase_order, Company $company, array $event_vars)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->purchase_order = $purchase_order;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
 | 
					        $this->event_vars = $event_vars;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										49
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasRestored.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasRestored.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Events\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Class PurchaseOrderWasRestored.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class PurchaseOrderWasRestored
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @var PurchaseOrder
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public $purchase_order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $event_vars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $fromDeleted;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create a new event instance.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param PurchaseOrder $purchase_order
 | 
				
			||||||
 | 
					     * @param Company $company
 | 
				
			||||||
 | 
					     * @param array $event_vars
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(PurchaseOrder $purchase_order, $fromDeleted, Company $company, array $event_vars)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->purchase_order = $purchase_order;
 | 
				
			||||||
 | 
					        $this->fromDeleted = $fromDeleted;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
 | 
					        $this->event_vars = $event_vars;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasUpdated.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Events/PurchaseOrder/PurchaseOrderWasUpdated.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Events\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Class PurchaseOrderWasUpdated.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class PurchaseOrderWasUpdated
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @var PurchaseOrder
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public $purchase_order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $event_vars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create a new event instance.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param PurchaseOrder $purchase_order
 | 
				
			||||||
 | 
					     * @param Company $company
 | 
				
			||||||
 | 
					     * @param array $event_vars
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(PurchaseOrder $purchase_order, Company $company, array $event_vars)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->purchase_order = $purchase_order;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
 | 
					        $this->event_vars = $event_vars;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,5 +1,13 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\Events\PurchaseOrder;
 | 
					namespace App\Events\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -8,20 +16,21 @@ use App\Models\PurchaseOrder;
 | 
				
			|||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class PurchaseOrderWasMarkedSent.
 | 
					 * Class PurchaseOrderWasViewed.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class PurchaseOrderWasMarkedSent
 | 
					class PurchaseOrderWasViewed
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    use SerializesModels;
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @var \App\Models\PurchaseOrder
 | 
					     * @var PurchaseOrder
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public $purchase_order;
 | 
					    public $purchase_order;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $company;
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $event_vars;
 | 
					    public $event_vars;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Create a new event instance.
 | 
					     * Create a new event instance.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -225,6 +225,7 @@ class InvoiceController extends BaseController
 | 
				
			|||||||
        $invoice = $invoice->service()
 | 
					        $invoice = $invoice->service()
 | 
				
			||||||
                           ->fillDefaults()
 | 
					                           ->fillDefaults()
 | 
				
			||||||
                           ->triggeredActions($request)
 | 
					                           ->triggeredActions($request)
 | 
				
			||||||
 | 
					                           ->adjustInventory()
 | 
				
			||||||
                           ->save();
 | 
					                           ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
@ -414,9 +415,14 @@ class InvoiceController extends BaseController
 | 
				
			|||||||
            return response()->json(['message' => ctrans('texts.locked_invoice')], 403);
 | 
					            return response()->json(['message' => ctrans('texts.locked_invoice')], 403);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $old_invoice = $invoice->line_items;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoice = $this->invoice_repo->save($request->all(), $invoice);
 | 
					        $invoice = $this->invoice_repo->save($request->all(), $invoice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoice->service()->triggeredActions($request)->touchPdf();
 | 
					        $invoice->service()
 | 
				
			||||||
 | 
					                ->triggeredActions($request)
 | 
				
			||||||
 | 
					                ->touchPdf()
 | 
				
			||||||
 | 
					                ->adjustInventory($old_invoice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,8 @@
 | 
				
			|||||||
namespace App\Http\Controllers;
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasCreated;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasUpdated;
 | 
				
			||||||
use App\Factory\PurchaseOrderFactory;
 | 
					use App\Factory\PurchaseOrderFactory;
 | 
				
			||||||
use App\Filters\PurchaseOrderFilters;
 | 
					use App\Filters\PurchaseOrderFilters;
 | 
				
			||||||
use App\Http\Requests\PurchaseOrder\ActionPurchaseOrderRequest;
 | 
					use App\Http\Requests\PurchaseOrder\ActionPurchaseOrderRequest;
 | 
				
			||||||
@ -26,6 +28,7 @@ use App\Models\Client;
 | 
				
			|||||||
use App\Models\PurchaseOrder;
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
use App\Repositories\PurchaseOrderRepository;
 | 
					use App\Repositories\PurchaseOrderRepository;
 | 
				
			||||||
use App\Transformers\PurchaseOrderTransformer;
 | 
					use App\Transformers\PurchaseOrderTransformer;
 | 
				
			||||||
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -182,6 +185,8 @@ class PurchaseOrderController extends BaseController
 | 
				
			|||||||
            ->fillDefaults()
 | 
					            ->fillDefaults()
 | 
				
			||||||
            ->save();
 | 
					            ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event(new PurchaseOrderWasCreated($purchase_order, $purchase_order->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($purchase_order);
 | 
					        return $this->itemResponse($purchase_order);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -352,6 +357,8 @@ class PurchaseOrderController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $purchase_order = $this->purchase_order_repository->save($request->all(), $purchase_order);
 | 
					        $purchase_order = $this->purchase_order_repository->save($request->all(), $purchase_order);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event(new PurchaseOrderWasUpdated($purchase_order, $purchase_order->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($purchase_order);
 | 
					        return $this->itemResponse($purchase_order);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -470,7 +477,7 @@ class PurchaseOrderController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $purchase_orders = PurchaseOrder::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
 | 
					        $purchase_orders = PurchaseOrder::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! $invoices) {
 | 
					        if (! $purchase_orders) {
 | 
				
			||||||
            return response()->json(['message' => 'No Purchase Orders Found']);
 | 
					            return response()->json(['message' => 'No Purchase Orders Found']);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -362,6 +362,7 @@ class BillingPortalPurchase extends Component
 | 
				
			|||||||
            ->service()
 | 
					            ->service()
 | 
				
			||||||
            ->markSent()
 | 
					            ->markSent()
 | 
				
			||||||
            ->fillDefaults()
 | 
					            ->fillDefaults()
 | 
				
			||||||
 | 
					            ->adjustInventory()
 | 
				
			||||||
            ->save();
 | 
					            ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Cache::put($this->hash, [
 | 
					        Cache::put($this->hash, [
 | 
				
			||||||
 | 
				
			|||||||
@ -38,9 +38,12 @@ class StoreProductRequest extends Request
 | 
				
			|||||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
					            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $rules['cost'] = 'numeric';
 | 
					        $rules['cost'] = 'sometimes|numeric';
 | 
				
			||||||
        $rules['price'] = 'numeric';
 | 
					        $rules['price'] = 'sometimes|numeric';
 | 
				
			||||||
        $rules['quantity'] = 'numeric';
 | 
					        $rules['quantity'] = 'sometimes|numeric';
 | 
				
			||||||
 | 
					        $rules['in_stock_quantity'] = 'sometimes|numeric';
 | 
				
			||||||
 | 
					        $rules['stock_notification_threshold'] = 'sometimes|numeric';
 | 
				
			||||||
 | 
					        $rules['stock_notification'] = 'sometimes|bool';
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        return $rules;
 | 
					        return $rules;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -44,6 +44,9 @@ class UpdateProductRequest extends Request
 | 
				
			|||||||
        $rules['cost'] = 'numeric';
 | 
					        $rules['cost'] = 'numeric';
 | 
				
			||||||
        $rules['price'] = 'numeric';
 | 
					        $rules['price'] = 'numeric';
 | 
				
			||||||
        $rules['quantity'] = 'numeric';
 | 
					        $rules['quantity'] = 'numeric';
 | 
				
			||||||
 | 
					        $rules['in_stock_quantity'] = 'sometimes|numeric';
 | 
				
			||||||
 | 
					        $rules['stock_notification_threshold'] = 'sometimes|numeric';
 | 
				
			||||||
 | 
					        $rules['stock_notification'] = 'sometimes|bool';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $rules;
 | 
					        return $rules;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -60,6 +63,13 @@ class UpdateProductRequest extends Request
 | 
				
			|||||||
            $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
 | 
					            $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(array_key_exists('in_stock_quantity', $input) && request()->has('update_in_stock_quantity') && request()->input('update_in_stock_quantity') == 'true'){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        elseif(array_key_exists('in_stock_quantity', $input)){
 | 
				
			||||||
 | 
					            unset($input['in_stock_quantity']);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->replace($input);
 | 
					        $this->replace($input);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -71,6 +71,7 @@ class BaseTransformer
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $client_id_search = $this->company
 | 
					            $client_id_search = $this->company
 | 
				
			||||||
                ->clients()
 | 
					                ->clients()
 | 
				
			||||||
 | 
					                ->where('is_deleted', false)
 | 
				
			||||||
                ->where('id_number', $client_name);
 | 
					                ->where('id_number', $client_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($client_id_search->count() >= 1) {
 | 
					            if ($client_id_search->count() >= 1) {
 | 
				
			||||||
@ -79,6 +80,7 @@ class BaseTransformer
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $client_name_search = $this->company
 | 
					            $client_name_search = $this->company
 | 
				
			||||||
                ->clients()
 | 
					                ->clients()
 | 
				
			||||||
 | 
					                ->where('is_deleted', false)
 | 
				
			||||||
                ->where('name', $client_name);
 | 
					                ->where('name', $client_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($client_name_search->count() >= 1) {
 | 
					            if ($client_name_search->count() >= 1) {
 | 
				
			||||||
@ -86,10 +88,11 @@ class BaseTransformer
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (!empty($client_email)) {
 | 
					        if (!empty($client_email)) {
 | 
				
			||||||
            $contacts = ClientContact::where(
 | 
					            $contacts = ClientContact::whereHas('client', function($query){
 | 
				
			||||||
                'company_id',
 | 
					                $query->where('is_deleted', false);
 | 
				
			||||||
                $this->company->id
 | 
					            })
 | 
				
			||||||
            )->where('email', $client_email);
 | 
					            ->where('company_id', $this->company->id)
 | 
				
			||||||
 | 
					            ->where('email', $client_email);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($contacts->count() >= 1) {
 | 
					            if ($contacts->count() >= 1) {
 | 
				
			||||||
                return $contacts->first()->client_id;
 | 
					                return $contacts->first()->client_id;
 | 
				
			||||||
@ -109,6 +112,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->company
 | 
					        return $this->company
 | 
				
			||||||
            ->clients()
 | 
					            ->clients()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -124,6 +128,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->company
 | 
					        return $this->company
 | 
				
			||||||
            ->vendors()
 | 
					            ->vendors()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -139,6 +144,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->company
 | 
					        return $this->company
 | 
				
			||||||
            ->projects()
 | 
					            ->projects()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -154,6 +160,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->company
 | 
					        return $this->company
 | 
				
			||||||
            ->products()
 | 
					            ->products()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`product_key`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`product_key`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $key)),
 | 
					                strtolower(str_replace(' ', '', $key)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -186,6 +193,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $client = $this->company
 | 
					        $client = $this->company
 | 
				
			||||||
            ->clients()
 | 
					            ->clients()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -203,6 +211,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $product = $this->company
 | 
					        $product = $this->company
 | 
				
			||||||
            ->products()
 | 
					            ->products()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`product_key`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`product_key`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $key)),
 | 
					                strtolower(str_replace(' ', '', $key)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -273,6 +282,7 @@ class BaseTransformer
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $tax_rate = $this->company
 | 
					        $tax_rate = $this->company
 | 
				
			||||||
            ->tax_rates()
 | 
					            ->tax_rates()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -292,6 +302,7 @@ class BaseTransformer
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $tax_rate = $this->company
 | 
					        $tax_rate = $this->company
 | 
				
			||||||
            ->tax_rates()
 | 
					            ->tax_rates()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -341,6 +352,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $invoice = $this->company
 | 
					        $invoice = $this->company
 | 
				
			||||||
            ->invoices()
 | 
					            ->invoices()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $invoice_number)),
 | 
					                strtolower(str_replace(' ', '', $invoice_number)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -358,6 +370,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->company
 | 
					        return $this->company
 | 
				
			||||||
            ->invoices()
 | 
					            ->invoices()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $invoice_number)),
 | 
					                strtolower(str_replace(' ', '', $invoice_number)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -371,6 +384,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->company
 | 
					        return $this->company
 | 
				
			||||||
            ->expenses()
 | 
					            ->expenses()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $expense_number)),
 | 
					                strtolower(str_replace(' ', '', $expense_number)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -386,6 +400,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->company
 | 
					        return $this->company
 | 
				
			||||||
            ->quotes()
 | 
					            ->quotes()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $quote_number)),
 | 
					                strtolower(str_replace(' ', '', $quote_number)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -401,6 +416,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $invoice = $this->company
 | 
					        $invoice = $this->company
 | 
				
			||||||
            ->invoices()
 | 
					            ->invoices()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`number`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $invoice_number)),
 | 
					                strtolower(str_replace(' ', '', $invoice_number)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -418,6 +434,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $vendor = $this->company
 | 
					        $vendor = $this->company
 | 
				
			||||||
            ->vendors()
 | 
					            ->vendors()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -452,6 +469,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $ec = $this->company
 | 
					        $ec = $this->company
 | 
				
			||||||
            ->expense_categories()
 | 
					            ->expense_categories()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
@ -486,6 +504,7 @@ class BaseTransformer
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $project = $this->company
 | 
					        $project = $this->company
 | 
				
			||||||
            ->projects()
 | 
					            ->projects()
 | 
				
			||||||
 | 
					            ->where('is_deleted', false)
 | 
				
			||||||
            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
					            ->whereRaw("LOWER(REPLACE(`name`, ' ' ,''))  = ?", [
 | 
				
			||||||
                strtolower(str_replace(' ', '', $name)),
 | 
					                strtolower(str_replace(' ', '', $name)),
 | 
				
			||||||
            ])
 | 
					            ])
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Jobs\Inventory;
 | 
					namespace App\Jobs\Inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Jobs\Mail\NinjaMailer;
 | 
				
			||||||
 | 
					use App\Jobs\Mail\NinjaMailerJob;
 | 
				
			||||||
 | 
					use App\Jobs\Mail\NinjaMailerObject;
 | 
				
			||||||
use App\Libraries\MultiDB;
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Mail\Admin\InventoryNotificationObject;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\Product;
 | 
					use App\Models\Product;
 | 
				
			||||||
@ -20,10 +24,9 @@ use Illuminate\Bus\Queueable;
 | 
				
			|||||||
use Illuminate\Contracts\Queue\ShouldQueue;
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
use Illuminate\Foundation\Bus\Dispatchable;
 | 
					use Illuminate\Foundation\Bus\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\InteractsWithQueue;
 | 
					use Illuminate\Queue\InteractsWithQueue;
 | 
				
			||||||
 | 
					use Illuminate\Queue\Middleware\WithoutOverlapping;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//todo - ensure we are MultiDB Aware in dispatched jobs
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class AdjustProductInventory implements ShouldQueue
 | 
					class AdjustProductInventory implements ShouldQueue
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 | 
					    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 | 
				
			||||||
@ -34,9 +37,8 @@ class AdjustProductInventory implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public array $old_invoice;
 | 
					    public array $old_invoice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function __construct(Company $company, Invoice $invoice, array $old_invoice = [])
 | 
					    public function __construct(Company $company, Invoice $invoice, ?array $old_invoice = [])
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->company = $company;
 | 
					        $this->company = $company;
 | 
				
			||||||
        $this->invoice = $invoice;
 | 
					        $this->invoice = $invoice;
 | 
				
			||||||
        $this->old_invoice = $old_invoice;
 | 
					        $this->old_invoice = $old_invoice;
 | 
				
			||||||
@ -53,12 +55,18 @@ class AdjustProductInventory implements ShouldQueue
 | 
				
			|||||||
        MultiDB::setDb($this->company->db);
 | 
					        MultiDB::setDb($this->company->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(count($this->old_invoice) > 0)
 | 
					        if(count($this->old_invoice) > 0)
 | 
				
			||||||
            return $this->existingInventoryAdjustment();
 | 
					            $this->existingInventoryAdjustment();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->newInventoryAdjustment();
 | 
					        return $this->newInventoryAdjustment();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function middleware()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return [new WithoutOverlapping($this->company->company_key)];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private function newInventoryAdjustment()
 | 
					    private function newInventoryAdjustment()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
@ -68,16 +76,18 @@ class AdjustProductInventory implements ShouldQueue
 | 
				
			|||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $p = Product::where('product_key', $item->product_key)->where('company_id', $this->company->id)->where('in_stock_quantity', '>', 0)->first();
 | 
					            $p = Product::where('product_key', $item->product_key)->where('company_id', $this->company->id)->where('in_stock_quantity', '>', 0)->first();
 | 
				
			||||||
            $p->in_stock_quantity -= $item->quantity;
 | 
					 | 
				
			||||||
            $p->save();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //check threshols and notify user
 | 
					            if(!$p)
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $p->in_stock_quantity -= $item->quantity;
 | 
				
			||||||
 | 
					            $p->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if($p->stock_notification_threshold && $p->in_stock_quantity <= $p->stock_notification_threshold)
 | 
					            if($p->stock_notification_threshold && $p->in_stock_quantity <= $p->stock_notification_threshold)
 | 
				
			||||||
                $this->notifyStockLevels($p, 'product');
 | 
					                $this->notifyStockLevels($p, 'product');
 | 
				
			||||||
            elseif($this->company->stock_notification_threshold && $p->in_stock_quantity <= $this->company->stock_notification_threshold){
 | 
					            elseif($this->company->stock_notification_threshold && $p->in_stock_quantity <= $this->company->stock_notification_threshold)
 | 
				
			||||||
                $this->notifyStocklevels($p, 'company');
 | 
					                $this->notifyStocklevels($p, 'company');
 | 
				
			||||||
            }
 | 
					            
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -85,11 +95,31 @@ class AdjustProductInventory implements ShouldQueue
 | 
				
			|||||||
    private function existingInventoryAdjustment()
 | 
					    private function existingInventoryAdjustment()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        foreach($this->old_invoice as $item)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            $p = Product::where('product_key', $item->product_key)->where('company_id', $this->company->id)->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if(!$p)
 | 
				
			||||||
 | 
					                continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $p->in_stock_quantity += $item->quantity;
 | 
				
			||||||
 | 
					            $p->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private function notifyStocklevels(Product $product, string $notification_level)
 | 
					    private function notifyStocklevels(Product $product, string $notification_level)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $nmo = new NinjaMailerObject;
 | 
				
			||||||
 | 
					        $nmo->mailable = new NinjaMailer( (new InventoryNotificationObject($product, $notification_level))->build() );
 | 
				
			||||||
 | 
					        $nmo->company = $this->company;
 | 
				
			||||||
 | 
					        $nmo->settings = $this->company->settings;
 | 
				
			||||||
 | 
					        $nmo->to_user = $this->company->owner();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        NinjaMailerJob::dispatch($nmo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -87,6 +87,7 @@ class SendRecurring implements ShouldQueue
 | 
				
			|||||||
                               ->applyNumber()
 | 
					                               ->applyNumber()
 | 
				
			||||||
                               //->createInvitations() //need to only link invitations to those in the recurring invoice
 | 
					                               //->createInvitations() //need to only link invitations to those in the recurring invoice
 | 
				
			||||||
                               ->fillDefaults()
 | 
					                               ->fillDefaults()
 | 
				
			||||||
 | 
					                               ->adjustInventory()
 | 
				
			||||||
                               ->save();
 | 
					                               ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -89,6 +89,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			|||||||
use Illuminate\Foundation\Bus\Dispatchable;
 | 
					use Illuminate\Foundation\Bus\Dispatchable;
 | 
				
			||||||
use Illuminate\Http\UploadedFile;
 | 
					use Illuminate\Http\UploadedFile;
 | 
				
			||||||
use Illuminate\Queue\InteractsWithQueue;
 | 
					use Illuminate\Queue\InteractsWithQueue;
 | 
				
			||||||
 | 
					use Illuminate\Queue\Middleware\WithoutOverlapping;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
use Illuminate\Support\Carbon;
 | 
					use Illuminate\Support\Carbon;
 | 
				
			||||||
use Illuminate\Support\Facades\App;
 | 
					use Illuminate\Support\Facades\App;
 | 
				
			||||||
@ -187,6 +188,11 @@ class Import implements ShouldQueue
 | 
				
			|||||||
        $this->resources = $resources;
 | 
					        $this->resources = $resources;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function middleware()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return [new WithoutOverlapping($this->company->account->key)];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Execute the job.
 | 
					     * Execute the job.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 | 
				
			|||||||
@ -127,7 +127,6 @@ class PaymentNotification implements ShouldQueue
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    private function sendAnalytics($data)
 | 
					    private function sendAnalytics($data)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        nlog($data);
 | 
					 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        $data = utf8_encode($data);
 | 
					        $data = utf8_encode($data);
 | 
				
			||||||
        $curl = curl_init();
 | 
					        $curl = curl_init();
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										58
									
								
								app/Listeners/PurchaseOrder/CreatePurchaseOrderActivity.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								app/Listeners/PurchaseOrder/CreatePurchaseOrderActivity.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Listeners\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Models\Activity;
 | 
				
			||||||
 | 
					use App\Repositories\ActivityRepository;
 | 
				
			||||||
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class CreatePurchaseOrderActivity implements ShouldQueue
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected $activity_repo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $delay = 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create the event listener.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param ActivityRepository $activity_repo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(ActivityRepository $activity_repo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->activity_repo = $activity_repo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handle the event.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  object  $event
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function handle($event)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        MultiDB::setDb($event->company->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields = new stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->purchase_order->user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->user_id = $user_id;
 | 
				
			||||||
 | 
					        $fields->purchase_order_id = $event->purchase_order->id;
 | 
				
			||||||
 | 
					        $fields->vendor_id = $event->purchase_order->vendor_id;
 | 
				
			||||||
 | 
					        $fields->company_id = $event->purchase_order->company_id;
 | 
				
			||||||
 | 
					        $fields->activity_type_id = Activity::CREATE_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->activity_repo->save($fields, $event->purchase_order, $event->event_vars);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,59 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Listeners\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Models\Activity;
 | 
				
			||||||
 | 
					use App\Repositories\ActivityRepository;
 | 
				
			||||||
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PurchaseOrderArchivedActivity implements ShouldQueue
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected $activity_repo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $delay = 5;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create the event listener.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param ActivityRepository $activity_repo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(ActivityRepository $activity_repo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->activity_repo = $activity_repo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handle the event.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  object  $event
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function handle($event)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        MultiDB::setDb($event->company->db);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $fields = new stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->purchase_order->user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->user_id = $user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->purchase_order_id = $event->purchase_order->id;
 | 
				
			||||||
 | 
					        $fields->vendor_id = $event->purchase_order->vendor_id;
 | 
				
			||||||
 | 
					        $fields->company_id = $event->purchase_order->company_id;
 | 
				
			||||||
 | 
					        $fields->activity_type_id = Activity::ARCHIVE_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->activity_repo->save($fields, $event->purchase_order, $event->event_vars);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										58
									
								
								app/Listeners/PurchaseOrder/PurchaseOrderDeletedActivity.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								app/Listeners/PurchaseOrder/PurchaseOrderDeletedActivity.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Listeners\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Models\Activity;
 | 
				
			||||||
 | 
					use App\Repositories\ActivityRepository;
 | 
				
			||||||
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PurchaseOrderDeletedActivity implements ShouldQueue
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected $activity_repo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $delay = 5;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create the event listener.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param ActivityRepository $activity_repo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(ActivityRepository $activity_repo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->activity_repo = $activity_repo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handle the event.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  object  $event
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function handle($event)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        MultiDB::setDb($event->company->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields = new stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->purchase_order->user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->user_id = $user_id;
 | 
				
			||||||
 | 
					        $fields->purchase_order_id = $event->purchase_order->id;
 | 
				
			||||||
 | 
					        $fields->vendor_id = $event->purchase_order->vendor_id;
 | 
				
			||||||
 | 
					        $fields->company_id = $event->purchase_order->company_id;
 | 
				
			||||||
 | 
					        $fields->activity_type_id = Activity::DELETE_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->activity_repo->save($fields, $event->purchase_order, $event->event_vars);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										59
									
								
								app/Listeners/PurchaseOrder/PurchaseOrderEmailActivity.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								app/Listeners/PurchaseOrder/PurchaseOrderEmailActivity.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,59 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://purchase_orderninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/purchase_orderninja/purchase_orderninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://purchase_orderninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Listeners\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Models\Activity;
 | 
				
			||||||
 | 
					use App\Repositories\ActivityRepository;
 | 
				
			||||||
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PurchaseOrderEmailActivity implements ShouldQueue
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected $activity_repo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $delay = 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create the event listener.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param ActivityRepository $activity_repo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(ActivityRepository $activity_repo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->activity_repo = $activity_repo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handle the event.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  object  $event
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function handle($event)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        MultiDB::setDb($event->company->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields = new stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->invitation->purchase_order->user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->user_id = $user_id;
 | 
				
			||||||
 | 
					        $fields->purchase_order_id = $event->invitation->purchase_order->id;
 | 
				
			||||||
 | 
					        $fields->company_id = $event->invitation->purchase_order->company_id;
 | 
				
			||||||
 | 
					        $fields->vendor_contact_id = $event->invitation->purchase_order->vendor_contact_id;
 | 
				
			||||||
 | 
					        $fields->vendor_id = $event->invitation->purchase_order->vendor_id;
 | 
				
			||||||
 | 
					        $fields->activity_type_id = Activity::EMAIL_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->activity_repo->save($fields, $event->invitation->purchase_order, $event->event_vars);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Listeners\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Models\Activity;
 | 
				
			||||||
 | 
					use App\Repositories\ActivityRepository;
 | 
				
			||||||
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PurchaseOrderRestoredActivity implements ShouldQueue
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected $activity_repo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $delay = 5;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create the event listener.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param ActivityRepository $activity_repo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(ActivityRepository $activity_repo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->activity_repo = $activity_repo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handle the event.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  object  $event
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function handle($event)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        MultiDB::setDb($event->company->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields = new stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->purchase_order->user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->user_id = $user_id;
 | 
				
			||||||
 | 
					        $fields->purchase_order_id = $event->purchase_order->id;
 | 
				
			||||||
 | 
					        $fields->vendor_id = $event->purchase_order->vendor_id;
 | 
				
			||||||
 | 
					        $fields->company_id = $event->purchase_order->company_id;
 | 
				
			||||||
 | 
					        $fields->activity_type_id = Activity::RESTORE_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->activity_repo->save($fields, $event->purchase_order, $event->event_vars);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										62
									
								
								app/Listeners/PurchaseOrder/PurchaseOrderViewedActivity.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								app/Listeners/PurchaseOrder/PurchaseOrderViewedActivity.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,62 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Listeners\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Models\Activity;
 | 
				
			||||||
 | 
					use App\Repositories\ActivityRepository;
 | 
				
			||||||
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class PurchaseOrderViewedActivity implements ShouldQueue
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected $activity_repo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $delay = 5;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create the event listener.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param ActivityRepository $activity_repo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(ActivityRepository $activity_repo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->activity_repo = $activity_repo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handle the event.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  object  $event
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function handle($event)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        MultiDB::setDb($event->company->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields = new stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->invitation->purchase_order->user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $event->invitation->purchase_order->service()->markSent()->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->user_id = $user_id;
 | 
				
			||||||
 | 
					        $fields->company_id = $event->invitation->company_id;
 | 
				
			||||||
 | 
					        $fields->activity_type_id = Activity::VIEW_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					        $fields->vendor_id = $event->invitation->purchase_order->vendor_id;
 | 
				
			||||||
 | 
					        $fields->vendor_contact_id = $event->invitation->vendor_contact_id;
 | 
				
			||||||
 | 
					        $fields->invitation_id = $event->invitation->id;
 | 
				
			||||||
 | 
					        $fields->purchase_order_id = $event->invitation->purchase_order_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->activity_repo->save($fields, $event->invitation->purchase_order, $event->event_vars);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										58
									
								
								app/Listeners/PurchaseOrder/UpdatePurchaseOrderActivity.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								app/Listeners/PurchaseOrder/UpdatePurchaseOrderActivity.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Listeners\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
 | 
					use App\Models\Activity;
 | 
				
			||||||
 | 
					use App\Repositories\ActivityRepository;
 | 
				
			||||||
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class UpdatePurchaseOrderActivity implements ShouldQueue
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    protected $activity_repo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $delay = 5;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create the event listener.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param ActivityRepository $activity_repo
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(ActivityRepository $activity_repo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->activity_repo = $activity_repo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handle the event.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  object  $event
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function handle($event)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        MultiDB::setDB($event->company->db);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields = new stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $user_id = array_key_exists('user_id', $event->event_vars) ? $event->event_vars['user_id'] : $event->purchase_order->user_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $fields->user_id = $user_id;
 | 
				
			||||||
 | 
					        $fields->vendor_id = $event->purchase_order->vendor_id;
 | 
				
			||||||
 | 
					        $fields->company_id = $event->purchase_order->company_id;
 | 
				
			||||||
 | 
					        $fields->activity_type_id = Activity::UPDATE_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					        $fields->purchase_order_id = $event->purchase_order->id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->activity_repo->save($fields, $event->purchase_order, $event->event_vars);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										99
									
								
								app/Mail/Admin/InventoryNotificationObject.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										99
									
								
								app/Mail/Admin/InventoryNotificationObject.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,99 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Mail\Admin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Mail\Engine\PaymentEmailEngine;
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\Product;
 | 
				
			||||||
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
 | 
					use App\Utils\Number;
 | 
				
			||||||
 | 
					use Illuminate\Support\Facades\App;
 | 
				
			||||||
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class InventoryNotificationObject
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Product $product;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Company $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public string $notification_level;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function __construct(Product $product, string $notification_level)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->product = $product;
 | 
				
			||||||
 | 
					        $this->company = $product->company;
 | 
				
			||||||
 | 
					        $this->settings = $this->company->settings;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function build()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        App::forgetInstance('translator');
 | 
				
			||||||
 | 
					        /* Init a new copy of the translator*/
 | 
				
			||||||
 | 
					        $t = app('translator');
 | 
				
			||||||
 | 
					        /* Set the locale*/
 | 
				
			||||||
 | 
					        App::setLocale($this->company->getLocale());
 | 
				
			||||||
 | 
					        /* Set customized translations _NOW_ */
 | 
				
			||||||
 | 
					        $t->replace(Ninja::transformTranslations($this->company->settings));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $mail_obj = new stdClass;
 | 
				
			||||||
 | 
					        $mail_obj->amount = $this->getAmount();
 | 
				
			||||||
 | 
					        $mail_obj->subject = $this->getSubject();
 | 
				
			||||||
 | 
					        $mail_obj->data = $this->getData();
 | 
				
			||||||
 | 
					        $mail_obj->markdown = 'email.admin.generic';
 | 
				
			||||||
 | 
					        $mail_obj->tag = $this->company->company_key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $mail_obj;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private function getAmount()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->product->in_stock_quantity;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private function getSubject()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					            ctrans(
 | 
				
			||||||
 | 
					                'texts.inventory_notification_subject',
 | 
				
			||||||
 | 
					                ['product' => $this->product->product_key . ": " . $this->product->notes]
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private function getData()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $data = [
 | 
				
			||||||
 | 
					            'title' => $this->getSubject(),
 | 
				
			||||||
 | 
					            'content' => ctrans(
 | 
				
			||||||
 | 
					                'texts.inventory_notification_body',
 | 
				
			||||||
 | 
					                ['amount' => $this->getAmount(),
 | 
				
			||||||
 | 
					                'product' => $this->product->product_key . ": " . $this->product->notes,
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					            ),
 | 
				
			||||||
 | 
					            'url' => config('ninja.app_url'),
 | 
				
			||||||
 | 
					            'button' => ctrans('texts.login'),
 | 
				
			||||||
 | 
					            'signature' => $this->settings->email_signature,
 | 
				
			||||||
 | 
					            'logo' => $this->company->present()->logo(),
 | 
				
			||||||
 | 
					            'settings' => $this->settings,
 | 
				
			||||||
 | 
					            'whitelabel' => $this->company->account->isPaid() ? true : false,
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $data;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -109,6 +109,14 @@ class Activity extends StaticModel
 | 
				
			|||||||
    const DELETE_RECURRING_EXPENSE = 123; 
 | 
					    const DELETE_RECURRING_EXPENSE = 123; 
 | 
				
			||||||
    const RESTORE_RECURRING_EXPENSE = 124; 
 | 
					    const RESTORE_RECURRING_EXPENSE = 124; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const CREATE_PURCHASE_ORDER = 130;
 | 
				
			||||||
 | 
					    const UPDATE_PURCHASE_ORDER = 131;
 | 
				
			||||||
 | 
					    const ARCHIVE_PURCHASE_ORDER = 132; 
 | 
				
			||||||
 | 
					    const DELETE_PURCHASE_ORDER = 133; 
 | 
				
			||||||
 | 
					    const RESTORE_PURCHASE_ORDER = 134;
 | 
				
			||||||
 | 
					    const EMAIL_PURCHASE_ORDER = 135; 
 | 
				
			||||||
 | 
					    const VIEW_PURCHASE_ORDER = 136;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected $casts = [
 | 
					    protected $casts = [
 | 
				
			||||||
        'is_system' => 'boolean',
 | 
					        'is_system' => 'boolean',
 | 
				
			||||||
        'updated_at' => 'timestamp',
 | 
					        'updated_at' => 'timestamp',
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers\GoCardless;
 | 
					namespace App\PaymentDrivers\GoCardless;
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers\GoCardless;
 | 
					namespace App\PaymentDrivers\GoCardless;
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers\GoCardless;
 | 
					namespace App\PaymentDrivers\GoCardless;
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers;
 | 
					namespace App\PaymentDrivers;
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers\Mollie;
 | 
					namespace App\PaymentDrivers\Mollie;
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers\Razorpay;
 | 
					namespace App\PaymentDrivers\Razorpay;
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers;
 | 
					namespace App\PaymentDrivers;
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\PaymentDrivers\Stripe;
 | 
					namespace App\PaymentDrivers\Stripe;
 | 
				
			||||||
 | 
				
			|||||||
@ -61,6 +61,13 @@ use App\Events\Payment\PaymentWasRestored;
 | 
				
			|||||||
use App\Events\Payment\PaymentWasUpdated;
 | 
					use App\Events\Payment\PaymentWasUpdated;
 | 
				
			||||||
use App\Events\Payment\PaymentWasVoided;
 | 
					use App\Events\Payment\PaymentWasVoided;
 | 
				
			||||||
use App\Events\PurchaseOrder\PurchaseOrderWasMarkedSent;
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasMarkedSent;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasArchived;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasCreated;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasDeleted;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasEmailed;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasRestored;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasUpdated;
 | 
				
			||||||
 | 
					use App\Events\PurchaseOrder\PurchaseOrderWasViewed;
 | 
				
			||||||
use App\Events\Quote\QuoteWasApproved;
 | 
					use App\Events\Quote\QuoteWasApproved;
 | 
				
			||||||
use App\Events\Quote\QuoteWasArchived;
 | 
					use App\Events\Quote\QuoteWasArchived;
 | 
				
			||||||
use App\Events\Quote\QuoteWasCreated;
 | 
					use App\Events\Quote\QuoteWasCreated;
 | 
				
			||||||
@ -171,6 +178,13 @@ use App\Listeners\Payment\PaymentEmailFailureActivity;
 | 
				
			|||||||
use App\Listeners\Payment\PaymentEmailedActivity;
 | 
					use App\Listeners\Payment\PaymentEmailedActivity;
 | 
				
			||||||
use App\Listeners\Payment\PaymentNotification;
 | 
					use App\Listeners\Payment\PaymentNotification;
 | 
				
			||||||
use App\Listeners\Payment\PaymentRestoredActivity;
 | 
					use App\Listeners\Payment\PaymentRestoredActivity;
 | 
				
			||||||
 | 
					use App\Listeners\PurchaseOrder\CreatePurchaseOrderActivity;
 | 
				
			||||||
 | 
					use App\Listeners\PurchaseOrder\PurchaseOrderArchivedActivity;
 | 
				
			||||||
 | 
					use App\Listeners\PurchaseOrder\PurchaseOrderDeletedActivity;
 | 
				
			||||||
 | 
					use App\Listeners\PurchaseOrder\PurchaseOrderEmailActivity;
 | 
				
			||||||
 | 
					use App\Listeners\PurchaseOrder\PurchaseOrderRestoredActivity;
 | 
				
			||||||
 | 
					use App\Listeners\PurchaseOrder\PurchaseOrderViewedActivity;
 | 
				
			||||||
 | 
					use App\Listeners\PurchaseOrder\UpdatePurchaseOrderActivity;
 | 
				
			||||||
use App\Listeners\Quote\QuoteApprovedActivity;
 | 
					use App\Listeners\Quote\QuoteApprovedActivity;
 | 
				
			||||||
use App\Listeners\Quote\QuoteApprovedNotification;
 | 
					use App\Listeners\Quote\QuoteApprovedNotification;
 | 
				
			||||||
use App\Listeners\Quote\QuoteApprovedWebhook;
 | 
					use App\Listeners\Quote\QuoteApprovedWebhook;
 | 
				
			||||||
@ -436,6 +450,27 @@ class EventServiceProvider extends ServiceProvider
 | 
				
			|||||||
        PaymentWasEmailedAndFailed::class => [
 | 
					        PaymentWasEmailedAndFailed::class => [
 | 
				
			||||||
            PaymentEmailFailureActivity::class,
 | 
					            PaymentEmailFailureActivity::class,
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
 | 
					        PurchaseOrderWasArchived::class => [
 | 
				
			||||||
 | 
					            PurchaseOrderArchivedActivity::class,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        PurchaseOrderWasCreated::class => [
 | 
				
			||||||
 | 
					            CreatePurchaseOrderActivity::class,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        PurchaseOrderWasDeleted::class => [
 | 
				
			||||||
 | 
					            PurchaseOrderDeletedActivity::class,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        PurchaseOrderWasEmailed::class => [
 | 
				
			||||||
 | 
					            PurchaseOrderEmailActivity::class,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        PurchaseOrderWasRestored::class => [
 | 
				
			||||||
 | 
					            PurchaseOrderRestoredActivity::class,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        PurchaseOrderWasUpdated::class => [
 | 
				
			||||||
 | 
					            UpdatePurchaseOrderActivity::class,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        PurchaseOrderWasViewed::class => [
 | 
				
			||||||
 | 
					            PurchaseOrderViewedActivity::class,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
        CompanyDocumentsDeleted::class => [
 | 
					        CompanyDocumentsDeleted::class => [
 | 
				
			||||||
            DeleteCompanyDocuments::class,
 | 
					            DeleteCompanyDocuments::class,
 | 
				
			||||||
        ],
 | 
					        ],
 | 
				
			||||||
@ -558,9 +593,7 @@ class EventServiceProvider extends ServiceProvider
 | 
				
			|||||||
        ],
 | 
					        ],
 | 
				
			||||||
        VendorWasUpdated::class => [
 | 
					        VendorWasUpdated::class => [
 | 
				
			||||||
            VendorUpdatedActivity::class,
 | 
					            VendorUpdatedActivity::class,
 | 
				
			||||||
        ],
 | 
					        ]
 | 
				
			||||||
        PurchaseOrderWasMarkedSent::class => [
 | 
					 | 
				
			||||||
        ],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -565,10 +565,11 @@ class InvoiceService
 | 
				
			|||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function adjustInventory()
 | 
					    public function adjustInventory($old_invoice = [])
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($this->invoice->company->track_inventory)
 | 
					        if($this->invoice->company->track_inventory)
 | 
				
			||||||
            AdjustProductInventory::dispatch($this->invoice->company, $this->invoice, null);
 | 
					            AdjustProductInventory::dispatchNow($this->invoice->company, $this->invoice, $old_invoice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -50,8 +50,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        $date_collection = collect();
 | 
					        $date_collection = collect();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder1_sent) &&
 | 
					        if (is_null($this->invoice->reminder1_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder1 == 'after_invoice_date' &&
 | 
					            $this->settings->schedule_reminder1 == 'after_invoice_date') {
 | 
				
			||||||
            $this->settings->enable_reminder1) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->date)->startOfDay()->addDays($this->settings->num_days_reminder1)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->date)->startOfDay()->addDays($this->settings->num_days_reminder1)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -59,8 +58,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder1_sent) &&
 | 
					        if (is_null($this->invoice->reminder1_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder1 == 'before_due_date' &&
 | 
					            $this->settings->schedule_reminder1 == 'before_due_date') {
 | 
				
			||||||
            $this->settings->enable_reminder1) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder1)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder1)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -68,8 +66,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder1_sent) &&
 | 
					        if (is_null($this->invoice->reminder1_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder1 == 'after_due_date' &&
 | 
					            $this->settings->schedule_reminder1 == 'after_due_date') {
 | 
				
			||||||
            $this->settings->enable_reminder1) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder1)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder1)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -77,8 +74,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder2_sent) &&
 | 
					        if (is_null($this->invoice->reminder2_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder2 == 'after_invoice_date' &&
 | 
					            $this->settings->schedule_reminder2 == 'after_invoice_date') {
 | 
				
			||||||
            $this->settings->enable_reminder2) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->date)->startOfDay()->addDays($this->settings->num_days_reminder2)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->date)->startOfDay()->addDays($this->settings->num_days_reminder2)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -86,8 +82,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder2_sent) &&
 | 
					        if (is_null($this->invoice->reminder2_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder2 == 'before_due_date' &&
 | 
					            $this->settings->schedule_reminder2 == 'before_due_date') {
 | 
				
			||||||
            $this->settings->enable_reminder2) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder2)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder2)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -95,8 +90,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder2_sent) &&
 | 
					        if (is_null($this->invoice->reminder2_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder2 == 'after_due_date' &&
 | 
					            $this->settings->schedule_reminder2 == 'after_due_date') {
 | 
				
			||||||
            $this->settings->enable_reminder2) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder2)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder2)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -104,8 +98,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder3_sent) &&
 | 
					        if (is_null($this->invoice->reminder3_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder3 == 'after_invoice_date' &&
 | 
					            $this->settings->schedule_reminder3 == 'after_invoice_date') {
 | 
				
			||||||
            $this->settings->enable_reminder3) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->date)->startOfDay()->addDays($this->settings->num_days_reminder3)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->date)->startOfDay()->addDays($this->settings->num_days_reminder3)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -113,8 +106,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder3_sent) &&
 | 
					        if (is_null($this->invoice->reminder3_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder3 == 'before_due_date' &&
 | 
					            $this->settings->schedule_reminder3 == 'before_due_date') {
 | 
				
			||||||
            $this->settings->enable_reminder3) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder3)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->subDays($this->settings->num_days_reminder3)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
@ -122,8 +114,7 @@ class UpdateReminder extends AbstractService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_null($this->invoice->reminder3_sent) &&
 | 
					        if (is_null($this->invoice->reminder3_sent) &&
 | 
				
			||||||
            $this->settings->schedule_reminder3 == 'after_due_date' &&
 | 
					            $this->settings->schedule_reminder3 == 'after_due_date') {
 | 
				
			||||||
            $this->settings->enable_reminder3) {
 | 
					 | 
				
			||||||
            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder3)->addSeconds($offset);
 | 
					            $reminder_date = Carbon::parse($this->invoice->due_date)->startOfDay()->addDays($this->settings->num_days_reminder3)->addSeconds($offset);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
					            if ($reminder_date->gt(Carbon::parse($this->invoice->next_send_date)))
 | 
				
			||||||
 | 
				
			|||||||
@ -11,8 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Services\PurchaseOrder;
 | 
					namespace App\Services\PurchaseOrder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
use App\Events\PurchaseOrder\PurchaseOrderWasMarkedSent;
 | 
					 | 
				
			||||||
use App\Models\PurchaseOrder;
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -46,8 +44,6 @@ class MarkSent
 | 
				
			|||||||
            //  ->touchPdf()
 | 
					            //  ->touchPdf()
 | 
				
			||||||
            ->save();
 | 
					            ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        event(new PurchaseOrderWasMarkedSent($this->purchase_order, $this->purchase_order->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this->purchase_order;
 | 
					        return $this->purchase_order;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -70,6 +70,7 @@ class ConvertQuote
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $invoice->service()
 | 
					        $invoice->service()
 | 
				
			||||||
                ->fillDefaults()
 | 
					                ->fillDefaults()
 | 
				
			||||||
 | 
					                ->adjustInventory()
 | 
				
			||||||
                ->save();
 | 
					                ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $quote->invoice_id = $invoice->id;
 | 
					        $quote->invoice_id = $invoice->id;
 | 
				
			||||||
 | 
				
			|||||||
@ -89,7 +89,7 @@ class PurchaseOrderTransformer extends EntityTransformer
 | 
				
			|||||||
            'custom_surcharge_tax3' => (bool)$purchase_order->custom_surcharge_tax3,
 | 
					            'custom_surcharge_tax3' => (bool)$purchase_order->custom_surcharge_tax3,
 | 
				
			||||||
            'custom_surcharge_tax4' => (bool)$purchase_order->custom_surcharge_tax4,
 | 
					            'custom_surcharge_tax4' => (bool)$purchase_order->custom_surcharge_tax4,
 | 
				
			||||||
            'line_items' => $purchase_order->line_items ?: (array)[],
 | 
					            'line_items' => $purchase_order->line_items ?: (array)[],
 | 
				
			||||||
            'entity_type' => 'credit',
 | 
					            'entity_type' => 'purchase_order',
 | 
				
			||||||
            'exchange_rate' => (float)$purchase_order->exchange_rate,
 | 
					            'exchange_rate' => (float)$purchase_order->exchange_rate,
 | 
				
			||||||
            'paid_to_date' => (float)$purchase_order->paid_to_date,
 | 
					            'paid_to_date' => (float)$purchase_order->paid_to_date,
 | 
				
			||||||
            'subscription_id' => $this->encodePrimaryKey($purchase_order->subscription_id),
 | 
					            'subscription_id' => $this->encodePrimaryKey($purchase_order->subscription_id),
 | 
				
			||||||
 | 
				
			|||||||
@ -14,8 +14,8 @@ return [
 | 
				
			|||||||
    'require_https' => env('REQUIRE_HTTPS', true),
 | 
					    'require_https' => env('REQUIRE_HTTPS', true),
 | 
				
			||||||
    'app_url' => rtrim(env('APP_URL', ''), '/'),
 | 
					    'app_url' => rtrim(env('APP_URL', ''), '/'),
 | 
				
			||||||
    'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
 | 
					    'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
 | 
				
			||||||
    'app_version' => '5.3.96',
 | 
					    'app_version' => '5.3.97',
 | 
				
			||||||
    'app_tag' => '5.3.96',
 | 
					    'app_tag' => '5.3.97',
 | 
				
			||||||
    'minimum_client_version' => '5.0.16',
 | 
					    'minimum_client_version' => '5.0.16',
 | 
				
			||||||
    'terms_version' => '1.0.1',
 | 
					    'terms_version' => '1.0.1',
 | 
				
			||||||
    'api_secret' => env('API_SECRET', ''),
 | 
					    'api_secret' => env('API_SECRET', ''),
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
namespace Database\Factories;
 | 
					namespace Database\Factories;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Gateway;
 | 
					use App\Models\Gateway;
 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license 
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Illuminate\Database\Migrations\Migration;
 | 
					use Illuminate\Database\Migrations\Migration;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,13 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
use Illuminate\Database\Migrations\Migration;
 | 
					use Illuminate\Database\Migrations\Migration;
 | 
				
			||||||
use Illuminate\Database\Schema\Blueprint;
 | 
					use Illuminate\Database\Schema\Blueprint;
 | 
				
			||||||
use Illuminate\Support\Facades\Schema;
 | 
					use Illuminate\Support\Facades\Schema;
 | 
				
			||||||
 | 
				
			|||||||
@ -4,9 +4,9 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @license https://opensource.org/licenses/AAL
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
use Illuminate\Database\Migrations\Migration;
 | 
					use Illuminate\Database\Migrations\Migration;
 | 
				
			||||||
use Illuminate\Database\Schema\Blueprint;
 | 
					use Illuminate\Database\Schema\Blueprint;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,13 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
use Illuminate\Database\Migrations\Migration;
 | 
					use Illuminate\Database\Migrations\Migration;
 | 
				
			||||||
use Illuminate\Database\Schema\Blueprint;
 | 
					use Illuminate\Database\Schema\Blueprint;
 | 
				
			||||||
use Illuminate\Support\Facades\Schema;
 | 
					use Illuminate\Support\Facades\Schema;
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,13 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
use App\Models\RecurringExpense;
 | 
					use App\Models\RecurringExpense;
 | 
				
			||||||
use App\Models\RecurringInvoice;
 | 
					use App\Models\RecurringInvoice;
 | 
				
			||||||
use Carbon\Carbon;
 | 
					use Carbon\Carbon;
 | 
				
			||||||
@ -9,12 +17,16 @@ use Illuminate\Support\Facades\Schema;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class SetRecurringClientTimestamp extends Migration
 | 
					class SetRecurringClientTimestamp extends Migration
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Run the migrations.
 | 
					     * Run the migrations.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function up()
 | 
					    public function up()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					        set_time_limit(0);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
        Schema::table('recurring_invoices', function (Blueprint $table) {
 | 
					        Schema::table('recurring_invoices', function (Blueprint $table) {
 | 
				
			||||||
            $table->datetime('next_send_date_client')->nullable();
 | 
					            $table->datetime('next_send_date_client')->nullable();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@ -24,7 +36,7 @@ class SetRecurringClientTimestamp extends Migration
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        RecurringInvoice::whereNotNull('next_send_date')->cursor()->each(function ($recurring_invoice){
 | 
					        RecurringInvoice::withTrashed()->whereNotNull('next_send_date')->cursor()->each(function ($recurring_invoice){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // $offset = $recurring_invoice->client->timezone_offset();
 | 
					            // $offset = $recurring_invoice->client->timezone_offset();
 | 
				
			||||||
            // $re = Carbon::parse($recurring_invoice->next_send_date)->subSeconds($offset)->format('Y-m-d');
 | 
					            // $re = Carbon::parse($recurring_invoice->next_send_date)->subSeconds($offset)->format('Y-m-d');
 | 
				
			||||||
@ -34,7 +46,7 @@ class SetRecurringClientTimestamp extends Migration
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        RecurringExpense::whereNotNull('next_send_date')->cursor()->each(function ($recurring_expense){
 | 
					        RecurringExpense::withTrashed()->whereNotNull('next_send_date')->cursor()->each(function ($recurring_expense){
 | 
				
			||||||
            $recurring_expense->next_send_date_client = $recurring_expense->next_send_date;
 | 
					            $recurring_expense->next_send_date_client = $recurring_expense->next_send_date;
 | 
				
			||||||
            $recurring_expense->saveQuietly();
 | 
					            $recurring_expense->saveQuietly();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,13 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use Illuminate\Database\Migrations\Migration;
 | 
					use Illuminate\Database\Migrations\Migration;
 | 
				
			||||||
use Illuminate\Database\Schema\Blueprint;
 | 
					use Illuminate\Database\Schema\Blueprint;
 | 
				
			||||||
@ -14,6 +22,8 @@ class CreatePurchaseOrderInvitationsTable extends Migration
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function up()
 | 
					    public function up()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        set_time_limit(0);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
        Schema::create('purchase_order_invitations', function (Blueprint $table) {
 | 
					        Schema::create('purchase_order_invitations', function (Blueprint $table) {
 | 
				
			||||||
            $table->id();
 | 
					            $table->id();
 | 
				
			||||||
            $table->unsignedInteger('company_id');
 | 
					            $table->unsignedInteger('company_id');
 | 
				
			||||||
@ -47,6 +57,10 @@ class CreatePurchaseOrderInvitationsTable extends Migration
 | 
				
			|||||||
            $table->unsignedInteger('client_id')->nullable()->change();
 | 
					            $table->unsignedInteger('client_id')->nullable()->change();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Schema::table('activities', function (Blueprint $table) {
 | 
				
			||||||
 | 
					            $table->unsignedInteger('purchase_order_id')->nullable();
 | 
				
			||||||
 | 
					            $table->unsignedInteger('vendor_contact_id')->nullable();
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Company::cursor()->each(function ($company){
 | 
					        Company::cursor()->each(function ($company){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -60,6 +74,8 @@ class CreatePurchaseOrderInvitationsTable extends Migration
 | 
				
			|||||||
            $settings->purchase_order_number_counter = 1; //@implemented
 | 
					            $settings->purchase_order_number_counter = 1; //@implemented
 | 
				
			||||||
            $settings->email_subject_purchase_order = '';
 | 
					            $settings->email_subject_purchase_order = '';
 | 
				
			||||||
            $settings->email_template_purchase_order = '';
 | 
					            $settings->email_template_purchase_order = '';
 | 
				
			||||||
 | 
					            $settings->require_purchase_order_signature = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $company->settings = $settings;
 | 
					            $company->settings = $settings;
 | 
				
			||||||
            $company->save();
 | 
					            $company->save();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@ -74,4 +90,5 @@ class CreatePurchaseOrderInvitationsTable extends Migration
 | 
				
			|||||||
    public function down()
 | 
					    public function down()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user