diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php
index f41fd49f1514..9598c85730b9 100644
--- a/app/Http/Controllers/InvoiceController.php
+++ b/app/Http/Controllers/InvoiceController.php
@@ -269,64 +269,68 @@ class InvoiceController extends BaseController
private static function getViewModel($invoice)
{
$recurringHelp = '';
- foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
- $parts = explode('=>', $line);
- if (count($parts) > 1) {
- $line = $parts[0].' => '.Utils::processVariables($parts[0]);
- $recurringHelp .= '
'.strip_tags($line).'';
- } else {
- $recurringHelp .= $line;
- }
- }
-
$recurringDueDateHelp = '';
- foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_due_date_help')) as $line) {
- $parts = explode('=>', $line);
- if (count($parts) > 1) {
- $line = $parts[0].' => '.Utils::processVariables($parts[0]);
- $recurringDueDateHelp .= ''.strip_tags($line).'';
- } else {
- $recurringDueDateHelp .= $line;
+ $recurringDueDates = [];
+
+ if ($invoice->is_recurring) {
+ foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_help')) as $line) {
+ $parts = explode('=>', $line);
+ if (count($parts) > 1) {
+ $line = $parts[0].' => '.Utils::processVariables($parts[0]);
+ $recurringHelp .= ''.strip_tags($line).'';
+ } else {
+ $recurringHelp .= $line;
+ }
+ }
+
+ foreach (preg_split("/((\r?\n)|(\r\n?))/", trans('texts.recurring_due_date_help')) as $line) {
+ $parts = explode('=>', $line);
+ if (count($parts) > 1) {
+ $line = $parts[0].' => '.Utils::processVariables($parts[0]);
+ $recurringDueDateHelp .= ''.strip_tags($line).'';
+ } else {
+ $recurringDueDateHelp .= $line;
+ }
+ }
+
+ // Create due date options
+ $recurringDueDates = [
+ trans('texts.use_client_terms') => ['value' => '', 'class' => 'monthly weekly'],
+ ];
+
+ $ends = ['th','st','nd','rd','th','th','th','th','th','th'];
+ for($i = 1; $i < 31; $i++){
+ if ($i >= 11 && $i <= 13) $ordinal = $i. 'th';
+ else $ordinal = $i . $ends[$i % 10];
+
+ $dayStr = str_pad($i, 2, '0', STR_PAD_LEFT);
+ $str = trans('texts.day_of_month', ['ordinal'=>$ordinal]);
+
+ $recurringDueDates[$str] = ['value' => "1998-01-$dayStr", 'data-num' => $i, 'class' => 'monthly'];
+ }
+ $recurringDueDates[trans('texts.last_day_of_month')] = ['value' => '1998-01-31', 'data-num' => 31, 'class' => 'monthly'];
+
+
+ $daysOfWeek = [
+ trans('texts.sunday'),
+ trans('texts.monday'),
+ trans('texts.tuesday'),
+ trans('texts.wednesday'),
+ trans('texts.thursday'),
+ trans('texts.friday'),
+ trans('texts.saturday'),
+ ];
+ foreach(['1st','2nd','3rd','4th'] as $i=>$ordinal){
+ foreach($daysOfWeek as $j=>$dayOfWeek){
+ $str = trans('texts.day_of_week_after', ['ordinal' => $ordinal, 'day' => $dayOfWeek]);
+
+ $day = $i * 7 + $j + 1;
+ $dayStr = str_pad($day, 2, '0', STR_PAD_LEFT);
+ $recurringDueDates[$str] = ['value' => "1998-02-$dayStr", 'data-num' => $day, 'class' => 'weekly'];
+ }
}
}
-
- // Create due date options
- $recurringDueDates = [
- trans('texts.use_client_terms') => ['value' => '', 'class' => 'monthly weekly'],
- ];
-
- $ends = ['th','st','nd','rd','th','th','th','th','th','th'];
- for($i = 1; $i < 31; $i++){
- if ($i >= 11 && $i <= 13) $ordinal = $i. 'th';
- else $ordinal = $i . $ends[$i % 10];
-
- $dayStr = str_pad($i, 2, '0', STR_PAD_LEFT);
- $str = trans('texts.day_of_month', ['ordinal'=>$ordinal]);
-
- $recurringDueDates[$str] = ['value' => "1998-01-$dayStr", 'data-num' => $i, 'class' => 'monthly'];
- }
- $recurringDueDates[trans('texts.last_day_of_month')] = ['value' => '1998-01-31', 'data-num' => 31, 'class' => 'monthly'];
-
-
- $daysOfWeek = [
- trans('texts.sunday'),
- trans('texts.monday'),
- trans('texts.tuesday'),
- trans('texts.wednesday'),
- trans('texts.thursday'),
- trans('texts.friday'),
- trans('texts.saturday'),
- ];
- foreach(['1st','2nd','3rd','4th'] as $i=>$ordinal){
- foreach($daysOfWeek as $j=>$dayOfWeek){
- $str = trans('texts.day_of_week_after', ['ordinal' => $ordinal, 'day' => $dayOfWeek]);
-
- $day = $i * 7 + $j + 1;
- $dayStr = str_pad($day, 2, '0', STR_PAD_LEFT);
- $recurringDueDates[$str] = ['value' => "1998-02-$dayStr", 'data-num' => $day, 'class' => 'weekly'];
- }
- }
-
+
// Tax rate $options
$account = Auth::user()->account;
$rates = TaxRate::scope()->orderBy('name')->get();