diff --git a/app/Console/Commands/BackupUpdate.php b/app/Console/Commands/BackupUpdate.php index 08afc83247..d1418a7a79 100644 --- a/app/Console/Commands/BackupUpdate.php +++ b/app/Console/Commands/BackupUpdate.php @@ -75,16 +75,19 @@ class BackupUpdate extends Command private function handleOnDb() { + set_time_limit(0); + + Backup::chunk(100, function ($backups) { + foreach ($backups as $backup) { + + if($backup->activity->client()->exists()){ - Backup::whereHas('activity')->whereNotNull('html_backup')->cursor()->each(function($backup){ + $client = $backup->activity->client; + $backup->storeRemotely($backup->html_backup, $client); - if($backup->activity->client()->exists()){ - - $client = $backup->activity->client; - $backup->storeRemotely($backup->html_backup, $client); + } } - }); } diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index 0656c39f1b..22fcba5c52 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -417,6 +417,7 @@ class CheckData extends Command payments.id = paymentables.payment_id WHERE paymentable_type = 'App\\Models\\Credit' AND paymentables.deleted_at is NULL + AND payments.is_deleted = 0 AND payments.client_id = ?; "), [$client->id] ); diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 0b04cc504e..bbf997f266 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -265,15 +265,16 @@ class MigrationController extends BaseController foreach($request->all() as $input){ - if($input instanceof UploadedFile) - nlog('is file'); + if($input instanceof UploadedFile){ + + } else $companies[] = json_decode($input,1); } } if (app()->environment() === 'local') { - nlog($request->all()); + } try { diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index b5aee3923d..20296b2d73 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -132,8 +132,6 @@ class TemplateEmail extends Mailable if($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)){ $ubl_string = CreateUbl::dispatchNow($this->invitation->invoice); - - nlog($ubl_string); if($ubl_string) $this->attachData($ubl_string, $this->invitation->invoice->getFileName('xml')); diff --git a/app/Models/Backup.php b/app/Models/Backup.php index 72fa770ca6..75540bc439 100644 --- a/app/Models/Backup.php +++ b/app/Models/Backup.php @@ -26,10 +26,10 @@ class Backup extends BaseModel 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; $path = $client->backup_path() . "/";