New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: moved billing_calculate to a laravel command. #13021
Conversation
… added new code to billing_calculate.php, so this will can still being used.
…ms into laravelbillingcalc
use Illuminate\Console\Command; | ||
use LibreNMS\Util\Number; | ||
|
||
require_once base_path() . '/includes/init.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this needs to be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean this line?(so this functions need also converted to laravel?
use LibreNMS\Util\Number;
require_once base_path() . '/includes/init.php';
This file is required for commands
use Illuminate\Console\Command;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and within there lies the pain ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this line be removed now?
$datefrom = $day_data['0']; | ||
$dateto = $day_data['1']; | ||
$check = BillHistory::where(['bill_id' => $bill->bill_id, 'bill_datefrom' => $datefrom, 'bill_dateto' => $dateto])->first(); | ||
$period = getPeriod($bill['bill_id'], $datefrom, $dateto); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can port these functions to class based ones, and if they are used in other places just replace the original function with a return myNewFunction()
we done that in many places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exact function probably should be in a model tho
$dateto = $day_data['1']; | ||
$check = BillHistory::where(['bill_id' => $bill->bill_id, 'bill_datefrom' => $datefrom, 'bill_dateto' => $dateto])->first(); | ||
$period = getPeriod($bill['bill_id'], $datefrom, $dateto); | ||
$date_updated = str_replace('-', '', str_replace(':', '', str_replace(' ', '', $check['updated']))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only a hint: str_replace([' ', ':', '-'], '', $check['updated'])
is easier to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks your input! I changed this line :)
Closing due to inactivity. |
Please give a short description what your pull request is for
Moved the billing_calculate.php to a laravel command and new code to billing_calculate.php for legacy purpose.
DO NOT DELETE THE UNDERLYING TEXT
Please note
Testers
If you would like to test this pull request then please run:
./scripts/github-apply <pr_id>
, i.e./scripts/github-apply 5926
After you are done testing, you can remove the changes with
./scripts/github-remove
. If there are schema changes, you can ask on discord how to revert.