mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-05 06:24:36 -04:00
Fixes for Recurring
This commit is contained in:
parent
70a575386c
commit
ff00ed3815
@ -54,7 +54,7 @@ class UpdateRecurringInvoiceRequest extends Request
|
|||||||
protected function prepareForValidation()
|
protected function prepareForValidation()
|
||||||
{
|
{
|
||||||
$input = $this->all();
|
$input = $this->all();
|
||||||
info($input);
|
|
||||||
if (array_key_exists('design_id', $input) && is_string($input['design_id'])) {
|
if (array_key_exists('design_id', $input) && is_string($input['design_id'])) {
|
||||||
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);
|
$input['design_id'] = $this->decodePrimaryKey($input['design_id']);
|
||||||
}
|
}
|
||||||
|
@ -44,20 +44,8 @@ class RecurringInvoice extends BaseModel
|
|||||||
const STATUS_PENDING = -1;
|
const STATUS_PENDING = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recurring intervals //todo MAP WHEN WE MIGRATE.
|
* Invoice Frequencies.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Make sure we support overflow!!!!!!!!!!
|
|
||||||
$start = Carbon::today();
|
|
||||||
$subscription = Carbon::parse('2017-12-31');
|
|
||||||
|
|
||||||
foreach (range(1, 12) as $month) {
|
|
||||||
$day = $start->addMonthNoOverflow()->thisDayOrLast($subscription->day);
|
|
||||||
|
|
||||||
echo "You will be billed on {$day} in month {$month}\n";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
const FREQUENCY_DAILY = 1;
|
const FREQUENCY_DAILY = 1;
|
||||||
const FREQUENCY_WEEKLY = 2;
|
const FREQUENCY_WEEKLY = 2;
|
||||||
const FREQUENCY_TWO_WEEKS = 3;
|
const FREQUENCY_TWO_WEEKS = 3;
|
||||||
|
@ -49,7 +49,10 @@ class RecurringService
|
|||||||
public function start()
|
public function start()
|
||||||
{
|
{
|
||||||
//make sure next_send_date is either now or in the future else return.
|
//make sure next_send_date is either now or in the future else return.
|
||||||
if(Carbon::parse($this->recurring_entity->next_send_date)->lt(now()))
|
// if(Carbon::parse($this->recurring_entity->next_send_date)->lt(now()))
|
||||||
|
// return $this;
|
||||||
|
|
||||||
|
if($this->recurring_entity->remaining_cycles == 0)
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
$this->recurring_entity->status_id = RecurringInvoice::STATUS_ACTIVE;
|
$this->recurring_entity->status_id = RecurringInvoice::STATUS_ACTIVE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user