mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-30 20:54:33 -04:00
Add documents to A_N_Y_T_H_I_N_G
This commit is contained in:
parent
7af826fa7f
commit
849e6040bd
@ -15,6 +15,7 @@ use App\Factory\ClientFactory;
|
|||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Repositories\ClientContactRepository;
|
use App\Repositories\ClientContactRepository;
|
||||||
use App\Utils\Traits\GeneratesCounter;
|
use App\Utils\Traits\GeneratesCounter;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +24,8 @@ use Illuminate\Http\Request;
|
|||||||
class ClientRepository extends BaseRepository
|
class ClientRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
use GeneratesCounter;
|
use GeneratesCounter;
|
||||||
|
use SavesDocuments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ClientContactRepository
|
* @var ClientContactRepository
|
||||||
*/
|
*/
|
||||||
@ -75,6 +78,9 @@ class ClientRepository extends BaseRepository
|
|||||||
$data['name'] = $client->present()->name();
|
$data['name'] = $client->present()->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('documents', $data)) {
|
||||||
|
$this->saveDocuments($data['documents'], $client);
|
||||||
|
}
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ use App\Models\Invoice;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Repositories\CreditRepository;
|
use App\Repositories\CreditRepository;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ use Illuminate\Support\Carbon;
|
|||||||
class PaymentRepository extends BaseRepository
|
class PaymentRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use SavesDocuments;
|
||||||
|
|
||||||
protected $credit_repo;
|
protected $credit_repo;
|
||||||
|
|
||||||
@ -89,6 +91,9 @@ class PaymentRepository extends BaseRepository
|
|||||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
|
if (array_key_exists('documents', $data)) {
|
||||||
|
$this->saveDocuments($data['documents'], $payment);
|
||||||
|
}
|
||||||
|
|
||||||
/*Ensure payment number generated*/
|
/*Ensure payment number generated*/
|
||||||
if (!$payment->number || strlen($payment->number) == 0) {
|
if (!$payment->number || strlen($payment->number) == 0) {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +20,8 @@ use Illuminate\Http\Request;
|
|||||||
*/
|
*/
|
||||||
class ProductRepository extends BaseRepository
|
class ProductRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
|
use SavesDocuments;
|
||||||
|
|
||||||
public function getClassName()
|
public function getClassName()
|
||||||
{
|
{
|
||||||
return Product::class;
|
return Product::class;
|
||||||
@ -34,6 +37,10 @@ class ProductRepository extends BaseRepository
|
|||||||
$product->fill($data);
|
$product->fill($data);
|
||||||
$product->save();
|
$product->save();
|
||||||
|
|
||||||
|
if (array_key_exists('documents', $data)) {
|
||||||
|
$this->saveDocuments($data['documents'], $product);
|
||||||
|
}
|
||||||
|
|
||||||
return $product;
|
return $product;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user