missing conditions adeded
This commit is contained in:
parent
27c0a4f8ee
commit
765cd5dab6
|
|
@ -107,6 +107,7 @@ class DownloadableLinkPurchasedRepository extends Repository
|
|||
}
|
||||
|
||||
$this->update([
|
||||
'status' => $purchasedLink->download_used == $totalInvoiceQty ? $status : $purchasedLink->status,
|
||||
'download_canceled' => $purchasedLink->download_bought - $totalInvoiceQty,
|
||||
], $purchasedLink->id);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ class DownloadableProductController extends Controller
|
|||
}
|
||||
|
||||
if ($downloadableLinkPurchased->download_bought
|
||||
&& ($downloadableLinkPurchased->download_bought - $downloadableLinkPurchased->download_used) <= 0) {
|
||||
&& ($downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + $downloadableLinkPurchased->download_canceled)) <= 0) {
|
||||
|
||||
session()->flash('warning', trans('shop::app.customer.account.downloadable_products.download-error'));
|
||||
|
||||
return redirect()->route('customer.downloadable_products.index');
|
||||
}
|
||||
|
||||
$remainingDownloads = $downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + 1);
|
||||
$remainingDownloads = $downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + $downloadableLinkPurchased->download_canceled + 1);
|
||||
|
||||
if ($downloadableLinkPurchased->download_bought) {
|
||||
$this->downloadableLinkPurchasedRepository->update([
|
||||
|
|
|
|||
Loading…
Reference in New Issue