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

Various fixes (#3136)

This commit is contained in:
Benjamin Beganović 2019-12-07 12:33:49 +01:00 committed by David Bomba
parent d07c11ef62
commit 259a28099f
4 changed files with 53 additions and 48 deletions

View File

@ -19,11 +19,14 @@ class CompanyFactory
{
use MakesHash;
public static function create(int $account_id) :Company
/**
* @param int $account_id
* @return Company
*/
public function create(int $account_id) :Company
{
$company = new Company;
// $company->name = '';
// $company->name = '';
$company->account_id = $account_id;
$company->company_key = $this->createHash();
$company->settings = CompanySettings::defaults();
@ -32,6 +35,5 @@ class CompanyFactory
$company->domain = '';
return $company;
}
}

View File

@ -31,7 +31,7 @@ class CreateProductRequest extends Request
{
return [
'product_key' => 'required',
]
];
}
}

View File

@ -30,7 +30,8 @@ class StoreClient
/**
* Create a new job instance.
*
* @return void
* @param array $data
* @param Client $client
*/
public function __construct(array $data, Client $client)
@ -43,9 +44,11 @@ class StoreClient
/**
* Execute the job.
*
* @return void
* @param ClientRepository $client_repo
* @param ClientContactRepository $client_contact_repo
* @return Client|null
*/
public function handle(ClientRepository $client_repo, ClientContactRepository $client_contact_repo) : ?Client
public function handle(ClientRepository $client_repo, ClientContactRepository $client_contact_repo) : ?Client {
$client = $client_repo->save($this->data, $this->client);

View File

@ -181,23 +181,23 @@ class Invoice extends BaseModel
return $this->client->getSetting('lock_sent_invoices');
}
/**
* Determines if invoice overdue.
*
* @param float $balance The balance
* @param date. $due_date The due date
*
* @return boolean True if overdue, False otherwise.
*/
public static function isOverdue($balance, $due_date)
{
if (! $this->formatValue($balance,2) > 0 || ! $due_date) {
return false;
}
// it isn't considered overdue until the end of the day
return strtotime($this->createClientDate(date(), $this->client->timezone()->name)) > (strtotime($due_date) + (60 * 60 * 24));
}
// /**
// * Determines if invoice overdue.
// *
// * @param float $balance The balance
// * @param date. $due_date The due date
// *
// * @return boolean True if overdue, False otherwise.
// */
// public static function isOverdue($balance, $due_date)
// {
// if (! $this->formatValue($balance,2) > 0 || ! $due_date) {
// return false;
// }
//
// // it isn't considered overdue until the end of the day
// return strtotime($this->createClientDate(date(), $this->client->timezone()->name)) > (strtotime($due_date) + (60 * 60 * 24));
// }
public function markViewed() :void
{