Fixes for deleting and reusing design names

This commit is contained in:
David Bomba 2021-06-03 08:02:30 +10:00
parent cb2c7d37ab
commit 214396fa43
3 changed files with 19 additions and 0 deletions

View File

@ -25,6 +25,7 @@ use App\Transformers\DesignTransformer;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Str;
/**
* Class DesignController.
@ -412,6 +413,7 @@ class DesignController extends BaseController
{
//may not need these destroy routes as we are using actions to 'archive/delete'
$design->is_deleted = true;
$design->name = $design->name . "_deleted_" . Str::random(5);
$design->delete();
$design->save();

View File

@ -11,9 +11,22 @@
namespace App\Repositories;
use App\Models\Design;
use Illuminate\Support\Str;
/**
* Class for DesignRepository .
*/
class DesignRepository extends BaseRepository
{
public function delete($design) :Design
{
$design->name = $design->name . "_deleted_" . Str::random(5);
parent::delete($design);
return $design;
}
}

View File

@ -232,6 +232,10 @@ class HtmlEngine
$data['$client2'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'client2', $this->client->custom_value2, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'client2')];
$data['$client3'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'client3', $this->client->custom_value3, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'client3')];
$data['$client4'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'client4', $this->client->custom_value4, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'client4')];
$data['$client.custom1'] = &$data['$client1'];
$data['$client.custom2'] = &$data['$client2'];
$data['$client.custom3'] = &$data['$client3'];
$data['$client.custom4'] = &$data['$client4'];
$data['$address1'] = ['value' => $this->client->address1 ?: ' ', 'label' => ctrans('texts.address1')];
$data['$address2'] = ['value' => $this->client->address2 ?: ' ', 'label' => ctrans('texts.address2')];
$data['$id_number'] = ['value' => $this->client->id_number ?: ' ', 'label' => ctrans('texts.id_number')];