mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:07:32 -05:00 
			
		
		
		
	Missing files (#3412)
This commit is contained in:
		
							parent
							
								
									1393179160
								
							
						
					
					
						commit
						2085fa38dc
					
				
							
								
								
									
										30
									
								
								app/Events/Credit/CreditWasMarkedSent.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								app/Events/Credit/CreditWasMarkedSent.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					namespace App\Events\Credit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\Credit;
 | 
				
			||||||
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Class CreditWasMarkedSent.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					class CreditWasMarkedSent
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    use SerializesModels;
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * @var Credit
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public $credit;
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Create a new event instance.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param Quote $credit
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(Credit $credit, Company $company)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->credit = $credit;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										34
									
								
								app/Services/Credit/MarkSent.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								app/Services/Credit/MarkSent.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Services\Credit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Events\Credit\CreditWasMarkedSent;
 | 
				
			||||||
 | 
					use App\Models\Credit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class MarkSent
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private $client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function __construct($client)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->client = $client;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function run($credit)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Return immediately if status is not draft */
 | 
				
			||||||
 | 
					        if ($credit->status_id != Credit::STATUS_DRAFT) {
 | 
				
			||||||
 | 
					            return $credit;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $credit->markInvitationsSent();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event(new CreditWasMarkedSent($credit, $credit->company));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $credit->service()->setStatus(Credit::STATUS_SENT)->applyNumber()->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $credit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user