This commit is contained in:
David Bomba 2022-02-19 16:11:30 +11:00
parent 25f8cd249d
commit 92e2c7c614
5 changed files with 16 additions and 13 deletions

View File

@ -75,16 +75,19 @@ class BackupUpdate extends Command
private function handleOnDb() private function handleOnDb()
{ {
set_time_limit(0);
Backup::whereHas('activity')->whereNotNull('html_backup')->cursor()->each(function($backup){ Backup::chunk(100, function ($backups) {
foreach ($backups as $backup) {
if($backup->activity->client()->exists()){ if($backup->activity->client()->exists()){
$client = $backup->activity->client; $client = $backup->activity->client;
$backup->storeRemotely($backup->html_backup, $client); $backup->storeRemotely($backup->html_backup, $client);
}
} }
}); });
} }

View File

@ -417,6 +417,7 @@ class CheckData extends Command
payments.id = paymentables.payment_id payments.id = paymentables.payment_id
WHERE paymentable_type = 'App\\Models\\Credit' WHERE paymentable_type = 'App\\Models\\Credit'
AND paymentables.deleted_at is NULL AND paymentables.deleted_at is NULL
AND payments.is_deleted = 0
AND payments.client_id = ?; AND payments.client_id = ?;
"), [$client->id] ); "), [$client->id] );

View File

@ -265,15 +265,16 @@ class MigrationController extends BaseController
foreach($request->all() as $input){ foreach($request->all() as $input){
if($input instanceof UploadedFile) if($input instanceof UploadedFile){
nlog('is file');
}
else else
$companies[] = json_decode($input,1); $companies[] = json_decode($input,1);
} }
} }
if (app()->environment() === 'local') { if (app()->environment() === 'local') {
nlog($request->all());
} }
try { try {

View File

@ -133,8 +133,6 @@ class TemplateEmail extends Mailable
$ubl_string = CreateUbl::dispatchNow($this->invitation->invoice); $ubl_string = CreateUbl::dispatchNow($this->invitation->invoice);
nlog($ubl_string);
if($ubl_string) if($ubl_string)
$this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml')); $this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml'));

View File

@ -26,10 +26,10 @@ class Backup extends BaseModel
return $this->belongsTo(Activity::class); return $this->belongsTo(Activity::class);
} }
public function storeRemotely(string $html, Client $client) public function storeRemotely(?string $html, Client $client)
{ {
if(strlen($html) == 0) if(!$html || strlen($html) == 0)
return; return;
$path = $client->backup_path() . "/"; $path = $client->backup_path() . "/";