mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Delete pdf when deleting invoice
This commit is contained in:
parent
cc84f9eb2e
commit
ab71be42a0
@ -23,6 +23,7 @@ use App\Utils\Helpers;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Google\Service\Vision\Property;
|
||||
use ReflectionClass;
|
||||
|
||||
class BaseRepository
|
||||
@ -185,15 +186,17 @@ class BaseRepository
|
||||
|
||||
if(!$model->id){
|
||||
$this->new_model = true;
|
||||
|
||||
$model->line_items = (collect($model->line_items))->map(function ($item) use($model,$client) {
|
||||
|
||||
$item->notes = Helpers::processReservedKeywords($item->notes, $client);
|
||||
if(is_array($model->line_items))
|
||||
{
|
||||
$model->line_items = (collect($model->line_items))->map(function ($item) use($model,$client) {
|
||||
|
||||
return $item;
|
||||
$item->notes = Helpers::processReservedKeywords($item->notes, $client);
|
||||
|
||||
});
|
||||
return $item;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$model->saveQuietly();
|
||||
|
@ -218,6 +218,7 @@ class InvoiceService
|
||||
public function markDeleted()
|
||||
{
|
||||
$this->removeUnpaidGatewayFees();
|
||||
$this->deletePdf();
|
||||
|
||||
$this->invoice = (new MarkInvoiceDeleted($this->invoice))->run();
|
||||
|
||||
@ -298,6 +299,9 @@ class InvoiceService
|
||||
} elseif ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) {
|
||||
$this->setStatus(Invoice::STATUS_PARTIAL);
|
||||
}
|
||||
elseif($this->invoice->balance < 0) {
|
||||
$this->setStatus(Invoice::STATUS_PARTIAL);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -71,10 +71,6 @@ class MarkInvoiceDeleted extends AbstractService
|
||||
|
||||
private function adjustPaidToDateAndBalance()
|
||||
{
|
||||
// $client = $this->invoice->client->fresh();
|
||||
// $client->paid_to_date += $this->adjustment_amount * -1;
|
||||
// $client->balance += $this->balance_adjustment * -1;
|
||||
// $client->save();
|
||||
|
||||
// 06-09-2022
|
||||
$this->invoice
|
||||
|
@ -65,7 +65,17 @@ trait ClientGroupSettingsSaver
|
||||
}
|
||||
|
||||
$entity->settings = $entity_settings;
|
||||
$entity->save();
|
||||
|
||||
try{
|
||||
$entity->save();
|
||||
}
|
||||
catch(\Exception $e){
|
||||
|
||||
nlog("client settings failure");
|
||||
nlog($entity_settings);
|
||||
nlog($e->getMessage());
|
||||
|
||||
}
|
||||
|
||||
return $entity_settings;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user