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

Fixes for quotas

This commit is contained in:
David Bomba 2023-06-18 14:34:35 +10:00
parent 1b1d7df53c
commit b496bf2c13
8 changed files with 9 additions and 80 deletions

View File

@ -77,7 +77,6 @@ class EntityFailedSendObject
private function setTemplate()
{
// nlog($this->template);
switch ($this->template) {
case 'invoice':

View File

@ -104,7 +104,6 @@ class EntitySentObject
private function setTemplate()
{
// nlog($this->template);
switch ($this->template) {
case 'invoice':

View File

@ -40,9 +40,7 @@ class CompanyRepository extends BaseRepository
$company->fill($data);
/** Only required to handle v4 migration workloads */
// if(Ninja::isHosted() && $company->isDirty('is_disabled') && !$company->is_disabled) {
if($company->isDirty('is_disabled') && !$company->is_disabled) {
nlog("trigger");
if(Ninja::isHosted() && $company->isDirty('is_disabled') && !$company->is_disabled) {
Ninja::triggerForwarding($company->company_key, $company->owner()->email);
}

View File

@ -319,73 +319,6 @@ class Design extends BaseDesign
return $elements;
}
//@deprecated
// public function entityDetailsx(): array
// {
// if ($this->type === 'statement') {
// $s_date = $this->translateDate($this->options['start_date'], $this->client->date_format(), $this->client->locale()) . " - " . $this->translateDate($this->options['end_date'], $this->client->date_format(), $this->client->locale());
// return [
// ['element' => 'p', 'content' => "<h2>".ctrans('texts.statement')."</h2>", 'properties' => ['data-ref' => 'statement-label']],
// ['element' => 'p', 'content' => ctrans('texts.statement_date'), 'properties' => ['data-ref' => 'statement-label'],'elements' =>
// ['element' => 'span', 'content' => "{$s_date} "]
// ],
// ['element' => 'p', 'content' => '$balance_due_label', 'properties' => ['data-ref' => 'statement-label'],'elements' =>
// ['element' => 'span', 'content' => Number::formatMoney($this->invoices->sum('balance'), $this->client)]
// ],
// ];
// }
// $variables = $this->context['pdf_variables']['invoice_details'];
// if ($this->entity instanceof Quote) {
// $variables = $this->context['pdf_variables']['quote_details'];
// if ($this->entity->partial > 0) {
// $variables[] = '$quote.balance_due';
// }
// }
// if ($this->entity instanceof Credit) {
// $variables = $this->context['pdf_variables']['credit_details'];
// }
// if ($this->vendor) {
// $variables = $this->context['pdf_variables']['purchase_order_details'];
// }
// $elements = [];
// // We don't want to show account balance or invoice total on PDF.. or any amount with currency.
// if ($this->type == self::DELIVERY_NOTE) {
// $variables = array_filter($variables, function ($m) {
// return !in_array($m, ['$invoice.balance_due', '$invoice.total']);
// });
// }
// foreach ($variables as $variable) {
// $_variable = explode('.', $variable)[1];
// $_customs = ['custom1', 'custom2', 'custom3', 'custom4'];
// /* 2/7/2022 don't show custom values if they are empty */
// $var = str_replace("custom", "custom_value", $_variable);
// if (in_array($_variable, $_customs) && !empty($this->entity->{$var})) {
// $elements[] = ['element' => 'div', 'properties' => ['style' => "display: table-row; visibility: {$this->entityVariableCheck($_variable)};"],'elements' => [
// ['element' => 'div', 'content' => $variable . '_label', 'properties' => ['class' => 'entity-details-cell', 'data-ref' => 'entity_details-' . substr($variable, 1) . '_label']],
// ['element' => 'div', 'content' => $variable, 'properties' => ['class' => 'entity-details-cell', 'data-ref' => 'entity_details-' . substr($variable, 1)]],
// ]];
// } else {
// $elements[] = ['element' => 'div', 'properties' => ['style' => "display: table-row; visibility: {$this->entityVariableCheck($variable)};"], 'elements' => [
// ['element' => 'div', 'content' => $variable . '_label', 'properties' => ['class' => 'entity-details-cell','data-ref' => 'entity_details-' . substr($variable, 1) . '_label']],
// ['element' => 'div', 'content' => $variable, 'properties' => ['class' => 'entity-details-cell','data-ref' => 'entity_details-' . substr($variable, 1)]],
// ]];
// }
// }
// return $elements;
// }
public function entityDetails(): array
{
if ($this->type === 'statement') {
@ -911,7 +844,6 @@ class Design extends BaseDesign
$variables = $this->context['pdf_variables']['total_columns'];
$elements = [
['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [
['element' => 'p', 'content' => strtr(str_replace(["labels","values"], ["",""], $_variables['values']['$entity.public_notes']), $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']],

View File

@ -84,8 +84,8 @@ class PdfMaker
/**
* Final method to get compiled HTML.
*
* @param bool $final @deprecated // is it? i still see it being called elsewhere
* @return mixed
* @param bool
* @return string
*/
public function getCompiledHTML($final = false)
{

View File

@ -37,8 +37,6 @@ class SendEmail
*/
public function run()
{
nlog($this->reminder_template);
nlog("is there a template");
if (! $this->reminder_template) {
$this->reminder_template = $this->quote->calculateTemplate('quote');

View File

@ -67,9 +67,12 @@ trait Inviteable
$writer = new Writer($renderer);
$qr = $writer->writeString($this->getPaymentLink(), 'utf-8');
return $qr;
// return "<p>{$qr}</p>";
return "<svg class='pqrcode' viewBox='0 0 200 200' width='200' height='200' x='0' y='0' xmlns='http://www.w3.org/2000/svg'>
<rect x='0' y='0' width='100%' height='100%' />{$qr}</svg>";
// return "<p><svg class='pqrcode' viewBox='0 0 200 200' width='200' height='200' x='0' y='0' xmlns='http://www.w3.org/2000/svg'>
// <rect x='0' y='0' width='100%' height='100%' />{$qr}</svg></p>";
}
public function getUnsubscribeLink()

View File

@ -126,7 +126,7 @@ class AccountEmailQuotaTest extends TestCase
$account->save();
Cache::put($account->key, 3000);
Cache::put("email_quota".$account->key, 3000);
$count = $account->emailsSent();