fix language clean after change and still use expired date from customer attribute when it have

This commit is contained in:
Ibnu Maksum
2024-06-21 16:51:38 +07:00
parent 2218115177
commit 04983e8a3a
7 changed files with 50 additions and 13 deletions

View File

@ -64,14 +64,30 @@ class Package
}
}
$day_exp = 20;
if ($p['prepaid'] == 'no') {
$day_exp = $p['expired_date'];
}
if (empty($day_exp)) {
$day_exp = 20;
if ($p['validity_unit'] == 'Period') {
// if customer has attribute Expired Date use it
$day_exp = User::getAttribute("Expired Date", $c['id']);
if (!$day_exp) {
$day_exp = 20;
$f = ORM::for_table('tbl_customers_fields')->create();
$f->customer_id = $c['id'];
$f->field_name = 'Expired Date';
$f->field_value = $day_exp;
$f->save();
}else{
// if customer no attribute Expired Date use plan expired date
$day_exp = 20;
if ($p['prepaid'] == 'no') {
$day_exp = $p['expired_date'];
}
if (empty($day_exp)) {
$day_exp = 20;
}
}
}
if ($router_name == 'balance') {
// insert table transactions
$t = ORM::for_table('tbl_transactions')->create();