mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Add client phone to invoice design fields
This commit is contained in:
parent
06acbe5460
commit
5ee474035a
@ -1201,10 +1201,18 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
if (! $this->last_sent_date) {
|
||||
return true;
|
||||
} else {
|
||||
$date1 = new DateTime($this->last_sent_date);
|
||||
$date2 = new DateTime();
|
||||
$diff = $date2->diff($date1);
|
||||
$daysSinceLastSent = $diff->format('%a');
|
||||
$monthsSinceLastSent = ($diff->format('%y') * 12) + $diff->format('%m');
|
||||
|
||||
/*
|
||||
$date1 = Carbon::parse($this->last_sent_date, $timezone);
|
||||
$date2 = Carbon::now($timezone);
|
||||
$daysSinceLastSent = $date1->diffInDays($date2);
|
||||
$monthsSinceLastSent = $date1->diffInMonths($date2);
|
||||
*/
|
||||
|
||||
if ($daysSinceLastSent == 0) {
|
||||
return false;
|
||||
|
@ -39,6 +39,10 @@ trait GeneratesNumbers
|
||||
$number = $prefix . str_pad($counter, $this->invoice_number_padding, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
if ($entity->recurring_invoice_id) {
|
||||
$number = $this->recurring_invoice_number_prefix . $number;
|
||||
}
|
||||
|
||||
if ($entity->isEntityType(ENTITY_CLIENT)) {
|
||||
$check = Client::scope(false, $this->id)->whereIdNumber($number)->withTrashed()->first();
|
||||
} else {
|
||||
@ -66,10 +70,6 @@ trait GeneratesNumbers
|
||||
}
|
||||
}
|
||||
|
||||
if ($entity->recurring_invoice_id) {
|
||||
$number = $this->recurring_invoice_number_prefix . $number;
|
||||
}
|
||||
|
||||
return $number;
|
||||
}
|
||||
|
||||
@ -161,7 +161,8 @@ trait GeneratesNumbers
|
||||
if (count($matches) > 1) {
|
||||
$format = $matches[1];
|
||||
$search[] = $matches[0];
|
||||
$date = Carbon::now(session(SESSION_TIMEZONE, DEFAULT_TIMEZONE))->format($format);
|
||||
$date = date_create()->format($format);
|
||||
//$date = Carbon::now(session(SESSION_TIMEZONE, DEFAULT_TIMEZONE))->format($format);
|
||||
$replace[] = str_replace($format, $date, $matches[1]);
|
||||
}
|
||||
|
||||
|
@ -96,14 +96,16 @@ trait PresentsInvoice
|
||||
'client.client_name',
|
||||
'client.id_number',
|
||||
'client.vat_number',
|
||||
'client.website',
|
||||
'client.work_phone',
|
||||
'client.address1',
|
||||
'client.address2',
|
||||
'client.city_state_postal',
|
||||
'client.postal_city_state',
|
||||
'client.country',
|
||||
'client.contact_name',
|
||||
'client.email',
|
||||
'client.phone',
|
||||
'client.contact_name',
|
||||
'client.custom_value1',
|
||||
'client.custom_value2',
|
||||
'.blank',
|
||||
@ -138,6 +140,8 @@ trait PresentsInvoice
|
||||
list($entityType, $fieldName) = explode('.', $field);
|
||||
if (substr($fieldName, 0, 6) == 'custom') {
|
||||
$fields[$section][$field] = $labels[$field];
|
||||
} elseif (in_array($field, ['client.phone', 'client.email'])) {
|
||||
$fields[$section][$field] = trans('texts.contact_' . $fieldName);
|
||||
} else {
|
||||
$fields[$section][$field] = $labels[$fieldName];
|
||||
}
|
||||
@ -222,6 +226,7 @@ trait PresentsInvoice
|
||||
'credit_issued_to',
|
||||
'credit_to',
|
||||
'your_credit',
|
||||
'work_phone',
|
||||
];
|
||||
|
||||
foreach ($fields as $field) {
|
||||
|
@ -2456,6 +2456,8 @@ $LANG = array(
|
||||
'purge_successful' => 'Successfully purged account data',
|
||||
'forbidden' => 'Forbidden',
|
||||
'purge_data_message' => 'Warning: This will permanently erase your data, there is no undo.',
|
||||
'contact_phone' => 'Contact Phone',
|
||||
'contact_email' => 'Contact Email',
|
||||
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user