1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #8673 from turbo124/v5-develop

v5.6.23
This commit is contained in:
David Bomba 2023-07-27 21:07:19 +10:00 committed by GitHub
commit 4869586832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 22 deletions

View File

@ -1 +1 @@
5.6.22
5.6.23

View File

@ -650,20 +650,20 @@ class BaseExport
}
if($column == 'amount')
return $entity->payments()->exists() ? $entity->payments()->sum('paymentables.amount') : ctrans('texts.unpaid');
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.amount') : ctrans('texts.unpaid');
if($column == 'refunded') {
return $entity->payments()->exists() ? $entity->payments()->sum('paymentables.refunded') : 0;
return $entity->payments()->exists() ? $entity->payments()->withoutTrashed()->sum('paymentables.refunded') : '';
}
if($column == 'applied') {
$refunded = $entity->payments()->sum('paymentables.refunded');
$amount = $entity->payments()->sum('paymentables.amount');
$refunded = $entity->payments()->withoutTrashed()->sum('paymentables.refunded');
$amount = $entity->payments()->withoutTrashed()->sum('paymentables.amount');
return $entity->payments()->exists() ? ($amount - $refunded) : 0;
return $entity->payments()->withoutTrashed()->exists() ? ($amount - $refunded) : '';
}
$payment = $entity->payments()->first();
$payment = $entity->payments()->withoutTrashed()->first();
if(!$payment)
return '';

View File

@ -67,7 +67,7 @@ class SupportMessageSent extends Mailable
$db = str_replace('db-ninja-', '', $company->db);
$is_large = $company->is_large ? 'L' : 'S';
$platform = array_key_exists('platform', $this->data) ? $this->data['platform'] : 'U';
$migrated = strlen($company->company_key) == 32 ? 'M' : '';
$migrated = ctype_lower(preg_replace('/[0-9]+/', '', $company->company_key)) ? 'M' : '';
$trial = $account->isTrial() ? 'T' : '';
$plan = str_replace('_', ' ', $plan);

View File

@ -30,18 +30,13 @@ trait MakesReminders
$offset = $this->client->timezone_offset();
// nlog($schedule_reminder. " ". $num_days_reminder);
// nlog("date = " . Carbon::parse($this->date)->addDays($num_days_reminder)->startOfDay()->addSeconds($offset));
// nlog("due date = " . Carbon::parse($this->due_date)->addDays($num_days_reminder)->startOfDay()->addSeconds($offset));
// nlog("now = " . Carbon::now()->startOfDay()->format('Y-m-d H:i:s'));
switch ($schedule_reminder) {
case 'after_invoice_date':
return Carbon::parse($this->date)->addDays($num_days_reminder)->startOfDay()->addSeconds($offset)->eq(Carbon::now());
return Carbon::parse($this->date)->addDays($num_days_reminder)->startOfDay()->addSeconds($offset)->isSameDay(Carbon::now());
case 'before_due_date':
return Carbon::parse($this->due_date)->subDays($num_days_reminder)->startOfDay()->addSeconds($offset)->eq(Carbon::now());
return Carbon::parse($this->due_date)->subDays($num_days_reminder)->startOfDay()->addSeconds($offset)->isSameDay(Carbon::now());
case 'after_due_date':
return Carbon::parse($this->due_date)->addDays($num_days_reminder)->startOfDay()->addSeconds($offset)->eq(Carbon::now());
return Carbon::parse($this->due_date)->addDays($num_days_reminder)->startOfDay()->addSeconds($offset)->isSameDay(Carbon::now());
default:
return null;
}
@ -81,7 +76,6 @@ trait MakesReminders
return $entity_string;
}
//also implement endless reminders here
}
private function checkEndlessReminder($last_sent_date, $endless_reminder_frequency_id) :bool

View File

@ -15,8 +15,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION','5.6.22'),
'app_tag' => env('APP_TAG','5.6.22'),
'app_version' => env('APP_VERSION','5.6.23'),
'app_tag' => env('APP_TAG','5.6.23'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -96,6 +96,8 @@ class LateFeeTest extends TestCase
public function testLateFeeAdded()
{
$this->travelTo(now()->subDays(15));
$settings = CompanySettings::defaults();
$settings->client_online_payment_notification = false;
$settings->client_manual_payment_notification = false;
@ -105,6 +107,7 @@ class LateFeeTest extends TestCase
$settings->enable_reminder1 = true;
$settings->num_days_reminder1 = 10;
$settings->schedule_reminder1 = 'after_due_date';
$settings->entity_send_time = '0';
$client = $this->buildData($settings);
@ -117,7 +120,7 @@ class LateFeeTest extends TestCase
'status_id' => 2,
'total_taxes' => 1,
'date' => now()->format('Y-m-d'),
'due_date' => now()->subDays(10)->format('Y-m-d'),
'due_date' => now()->addDays(10)->format('Y-m-d'),
'terms' => 'nada',
'discount' => 0,
'tax_rate1' => 0,
@ -131,11 +134,15 @@ class LateFeeTest extends TestCase
]);
$i = $i->calc()->getInvoice();
$i->service()->applyNumber()->createInvitations()->save();
$i->service()->markSent()->setReminder()->applyNumber()->createInvitations()->save();
// $this->travelBack();
$this->travelTo(now()->addDays(20)->startOfDay()->format('Y-m-d'));
$i = $i->fresh();
$this->assertEquals(10, $i->amount);
$this->assertEquals(10, $i->balance);
$reflectionMethod = new \ReflectionMethod(ReminderJob::class, 'sendReminderForInvoice');
$reflectionMethod->setAccessible(true);
$reflectionMethod->invokeArgs(new ReminderJob(), [$i]);
@ -144,6 +151,8 @@ class LateFeeTest extends TestCase
$this->assertEquals(20, $i->balance);
$this->travelBack();
}
public function testLateFeeAddedToNewInvoiceWithLockedInvoiceConfig()