1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
This commit is contained in:
Hillel Coren 2016-01-14 23:28:17 +02:00
parent 4e77317767
commit 9fdea0fe95

View File

@ -332,6 +332,17 @@ class Invoice extends EntityModel implements BalanceAffecting
return $this->partial > 0 ? $this->partial : $this->balance;
}
public function getCurrencyCode()
{
if ($this->client->currency) {
return $this->client->currency->code;
} elseif ($this->account->currency) {
return $this->account->currency->code;
} else {
return 'USD';
}
}
public function hidePrivateFields()
{
$this->setVisible([
@ -506,7 +517,7 @@ class Invoice extends EntityModel implements BalanceAffecting
}
}
if($this->due_date){
if($this->due_date && $this->due_date != '0000-00-00'){
// This is a recurring invoice; we're using a custom format here.
// The year is always 1998; January is 1st, 2nd, last day of the month.
// February is 1st Sunday after, 1st Monday after, ..., through 4th Saturday after.
@ -730,10 +741,17 @@ class Invoice extends EntityModel implements BalanceAffecting
];
curl_setopt_array($curl, $opts);
$encodedString = strip_tags(curl_exec($curl));
$response = curl_exec($curl);
curl_close($curl);
return Utils::decodePDF($encodedString);
$encodedString = strip_tags($response);
$pdfString = Utils::decodePDF($encodedString);
if ( ! $pdfString || strlen($pdfString) < 200) {
Utils::logError("PhantomJSCloud - failed to create pdf: {$encodedString}");
}
return $pdfString;
}
}