mirror of
https://github.com/hotspotbilling/phpnuxbill.git
synced 2025-08-18 00:29:15 +02:00
Expired Date by created date
This commit is contained in:
parent
c9058769ce
commit
2bb664e241
1 changed files with 5 additions and 1 deletions
|
@ -48,10 +48,14 @@ class Package
|
||||||
if ($p['validity_unit'] == 'Period') {
|
if ($p['validity_unit'] == 'Period') {
|
||||||
$f = ORM::for_table('tbl_customers_fields')->where('field_name', 'Expired Date')->where('customer_id', $c['id'])->find_one();
|
$f = ORM::for_table('tbl_customers_fields')->where('field_name', 'Expired Date')->where('customer_id', $c['id'])->find_one();
|
||||||
if (!$f) {
|
if (!$f) {
|
||||||
|
$day = date('d', strtotime($c['created_at']));
|
||||||
|
if ($day > 28) {
|
||||||
|
$day = 1;
|
||||||
|
}
|
||||||
$f = ORM::for_table('tbl_customers_fields')->create();
|
$f = ORM::for_table('tbl_customers_fields')->create();
|
||||||
$f->customer_id = $c['id'];
|
$f->customer_id = $c['id'];
|
||||||
$f->field_name = 'Expired Date';
|
$f->field_name = 'Expired Date';
|
||||||
$f->field_value = 20;
|
$f->field_value = $day;
|
||||||
$f->save();
|
$f->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue