|
|
@@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
namespace common\logic\Order\Order\Repository; |
|
|
|
|
|
|
|
use common\helpers\MeanPayment; |
|
|
|
use common\logic\AbstractRepository; |
|
|
|
use common\logic\Distribution\Distribution\Model\Distribution; |
|
|
|
use common\logic\Distribution\ProductDistribution\Repository\ProductDistributionRepository; |
|
|
@@ -313,11 +314,13 @@ class OrderRepository extends AbstractRepository |
|
|
|
$creditFunctioning = $this->producerRepository->getPointSaleCreditFunctioning($pointSale); |
|
|
|
|
|
|
|
if ($order->id_user && $this->producerRepository->getConfig('credit') && $pointSale->credit) { |
|
|
|
if ($creditFunctioning == Producer::CREDIT_FUNCTIONING_OPTIONAL) { |
|
|
|
return 0; |
|
|
|
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) { |
|
|
|
if($order->mean_payment == MeanPayment::CREDIT || $creditFunctioning == Producer::CREDIT_FUNCTIONING_MANDATORY) { |
|
|
|
return 1; |
|
|
|
} elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_USER) { |
|
|
|
} |
|
|
|
elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_OPTIONAL) { |
|
|
|
return 0; |
|
|
|
} |
|
|
|
elseif ($creditFunctioning == Producer::CREDIT_FUNCTIONING_USER) { |
|
|
|
$userProducer = UserProducer::searchOne([ |
|
|
|
'id_user' => $order->id_user, |
|
|
|
'id_producer' => $distribution->id_producer |