mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for Purchase Order Filters
This commit is contained in:
parent
05b3518fb7
commit
7b40340047
@ -70,7 +70,7 @@ class PurchaseOrderFilters extends QueryFilters
|
||||
if(count($status_parameters) >=1) {
|
||||
$query->whereIn('status_id', $status_parameters);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
return $this->builder;
|
||||
}
|
||||
|
@ -567,6 +567,12 @@ class BillingPortalPurchasev2 extends Component
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Starts the trial
|
||||
*
|
||||
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handleTrial()
|
||||
{
|
||||
return $this->subscription->service()->startTrial([
|
||||
@ -578,6 +584,12 @@ class BillingPortalPurchasev2 extends Component
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* When the subscription total comes to $0 we
|
||||
* pass back a $0 Invoice.
|
||||
*
|
||||
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handlePaymentNotRequired()
|
||||
{
|
||||
|
||||
@ -600,7 +612,7 @@ class BillingPortalPurchasev2 extends Component
|
||||
->save();
|
||||
|
||||
$invoice->number = null;
|
||||
|
||||
|
||||
$invoice->service()
|
||||
->markPaid()
|
||||
->save();
|
||||
|
@ -1291,7 +1291,12 @@ class SubscriptionService
|
||||
|
||||
}
|
||||
|
||||
private function getDaysInFrequency()
|
||||
/**
|
||||
* Get the number of days in the currency frequency
|
||||
*
|
||||
* @return int Number of days
|
||||
*/
|
||||
private function getDaysInFrequency() :int
|
||||
{
|
||||
|
||||
switch ($this->subscription->frequency_id) {
|
||||
@ -1325,7 +1330,15 @@ class SubscriptionService
|
||||
|
||||
}
|
||||
|
||||
public function getNextDateForFrequency($date, $frequency)
|
||||
/**
|
||||
* Get the next date by frequency_id
|
||||
*
|
||||
* @param Carbon $date The current carbon date
|
||||
* @param int $frequency The frequncy_id of the subscription
|
||||
*
|
||||
* @return ?Carbon The next date carbon object
|
||||
*/
|
||||
public function getNextDateForFrequency($date, $frequency) :?Carbon
|
||||
{
|
||||
switch ($frequency) {
|
||||
case RecurringInvoice::FREQUENCY_DAILY:
|
||||
@ -1353,7 +1366,7 @@ class SubscriptionService
|
||||
case RecurringInvoice::FREQUENCY_THREE_YEARS:
|
||||
return $date->addYears(3);
|
||||
default:
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1363,6 +1376,7 @@ class SubscriptionService
|
||||
* @param Invoice $invoice The Invoice
|
||||
* @param array $bundle The bundle array
|
||||
* @param ClientContact $contact The Client Contact
|
||||
*
|
||||
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handleNoPaymentFlow(Invoice $invoice, $bundle, ClientContact $contact)
|
||||
|
@ -40,6 +40,16 @@ class PurchaseOrderTest extends TestCase
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
public function testPurchaseOrderGetWithClientStatus()
|
||||
{
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->get('/api/v1/purchase_orders?client_status=sent'.$this->encodePrimaryKey($this->purchase_order->id));
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testPostNewPurchaseOrderPdf()
|
||||
{
|
||||
$purchase_order = [
|
||||
|
Loading…
Reference in New Issue
Block a user