diff --git a/app/commands/SendRecurringInvoices.php b/app/commands/SendRecurringInvoices.php index 9217077f81df..86061b14ba6e 100755 --- a/app/commands/SendRecurringInvoices.php +++ b/app/commands/SendRecurringInvoices.php @@ -36,7 +36,7 @@ class SendRecurringInvoices extends Command { continue; } - $invoice = Invoice::createNew($recurInvoice); + $invoice = Invoice::createNew($recurInvoice); $invoice->client_id = $recurInvoice->client_id; $invoice->recurring_invoice_id = $recurInvoice->id; $invoice->invoice_number = 'R' . $recurInvoice->account->getNextInvoiceNumber(); diff --git a/app/models/Activity.php b/app/models/Activity.php index fb227f6fd083..98fb5ce865e0 100755 --- a/app/models/Activity.php +++ b/app/models/Activity.php @@ -33,17 +33,16 @@ class Activity extends Eloquent return $this->belongsTo('Account'); } - private static function getBlank($entity = false) { $activity = new Activity; - if (Auth::check()) { - $activity->user_id = Auth::user()->id; - $activity->account_id = Auth::user()->account_id; - } else if ($entity) { + if ($entity) { $activity->user_id = $entity->user_id; $activity->account_id = $entity->account_id; + } else if (Auth::check()) { + $activity->user_id = Auth::user()->id; + $activity->account_id = Auth::user()->account_id; } else { Utils::fatalError(); } diff --git a/app/models/EntityModel.php b/app/models/EntityModel.php index cb0bc2b128e8..3269f8a8ac4f 100755 --- a/app/models/EntityModel.php +++ b/app/models/EntityModel.php @@ -12,12 +12,12 @@ class EntityModel extends Eloquent $className = get_called_class(); $entity = new $className(); - if (Auth::check()) { - $entity->user_id = Auth::user()->id; - $entity->account_id = Auth::user()->account_id; - } else if ($parent) { + if ($parent) { $entity->user_id = $parent->user_id; $entity->account_id = $parent->account_id; + } else if (Auth::check()) { + $entity->user_id = Auth::user()->id; + $entity->account_id = Auth::user()->account_id; } else { Utils::fatalError(); }