mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
contract_obligation_contract_dependency checking on complete and accept
This commit is contained in:
@@ -46,6 +46,12 @@ class ContractObligationController extends BaseController
|
||||
return $contract;
|
||||
}
|
||||
|
||||
public function updateAccept(Request $request, $hash_id)
|
||||
{
|
||||
$contract = ContractObligationModule::updateAccept($request, $hash_id);
|
||||
return $contract;
|
||||
}
|
||||
|
||||
public function delete(Request $request, $hash_id)
|
||||
{
|
||||
$contract = ContractObligationModule::delete($request, $hash_id);
|
||||
|
||||
@@ -224,7 +224,6 @@ class ContractObligationModule extends BaseController
|
||||
if (!$validation->status) {
|
||||
return response()->json($validation, 422);
|
||||
}
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$contract_obligation = ContractObligation::find($id);
|
||||
|
||||
@@ -61,8 +61,6 @@ class ContractDoneCheck implements Rule
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
if ($this->type == 'complete') {
|
||||
return config('error_code.contract_done_error');
|
||||
}
|
||||
return config('error_code.contract_done_error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Rules\User;
|
||||
|
||||
use Auth;
|
||||
use App\Models\ContractObligation;
|
||||
use App\Models\Contract;
|
||||
|
||||
use App\Http\Helpers\Hasher;
|
||||
|
||||
@@ -45,9 +46,9 @@ class ContractObligationCompleteOrAcceptCheck implements Rule
|
||||
|
||||
if (!empty($contract_obligation->contract_obligation_dependency_list)) {
|
||||
foreach ($contract_obligation->contract_obligation_dependency_list as $key_2 => $row_2) {
|
||||
$depend_id = Hasher::decode('contract_obligations', $row_2->depend_contract_obligation_hash_id);
|
||||
$depend_contract_obligation_id = Hasher::decode('contract_obligations', $row_2->depend_contract_obligation_hash_id);
|
||||
$depend_contract_obligation = ContractObligation::
|
||||
where('id', $depend_id)
|
||||
where('id', $depend_contract_obligation_id)
|
||||
->first();
|
||||
|
||||
if ($this->type == 'complete') {
|
||||
@@ -70,6 +71,18 @@ class ContractObligationCompleteOrAcceptCheck implements Rule
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($contract_obligation->contract_obligation_contract_dependency_list)) {
|
||||
foreach ($contract_obligation->contract_obligation_contract_dependency_list as $key_2 => $row_3) {
|
||||
$depend_contract_id = Hasher::decode('contracts', $row_3->depend_contract_hash_id);
|
||||
$depend_contract = Contract::
|
||||
where('id', $depend_contract_id)
|
||||
->first();
|
||||
if ($depend_contract->status != config('constants.contract.status.done')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,5 +100,8 @@ class ContractObligationCompleteOrAcceptCheck implements Rule
|
||||
if ($this->type == 'complete') {
|
||||
return config('error_code.contract_obligation_complete_error');
|
||||
}
|
||||
if ($this->type == 'accept') {
|
||||
return config('error_code.contract_obligation_accept_error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class ContractObligationEntitySignatureCheck implements Rule
|
||||
$entity_signature = EntitySignature::find($entity_signature_id);
|
||||
|
||||
if ($entity_signature) {
|
||||
if ($entity_signature->type == config('constants.entity.signature.master')) {
|
||||
if ($entity_signature->type == config('constants.entity.signature.master_key')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user