mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for contact API
This commit is contained in:
parent
ddc9df6650
commit
f96c0387a2
7
app/Policies/ContactPolicy.php
Normal file
7
app/Policies/ContactPolicy.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
class ContactPolicy extends EntityPolicy
|
||||||
|
{
|
||||||
|
}
|
51
app/Services/ContactService.php
Normal file
51
app/Services/ContactService.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Ninja\Repositories\ContactRepository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ContactService.
|
||||||
|
*/
|
||||||
|
class ContactService extends BaseService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var ContactRepository
|
||||||
|
*/
|
||||||
|
protected $contactRepo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContactService constructor.
|
||||||
|
*
|
||||||
|
* @param ContactRepository $contactRepo
|
||||||
|
*/
|
||||||
|
public function __construct(ContactRepository $contactRepo)
|
||||||
|
{
|
||||||
|
$this->contactRepo = $contactRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ContactRepository
|
||||||
|
*/
|
||||||
|
protected function getRepo()
|
||||||
|
{
|
||||||
|
return $this->contactRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
* @param null $contact
|
||||||
|
*
|
||||||
|
* @return mixed|null
|
||||||
|
*/
|
||||||
|
public function save($data, $contact = null)
|
||||||
|
{
|
||||||
|
if (isset($data['client_id']) && $data['client_id']) {
|
||||||
|
$data['client_id'] = Client::getPrivateId($data['client_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->contactRepo->save($data, $contact);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -59,6 +59,8 @@ If you require contacts to enter a password to see their invoice you'll need to
|
|||||||
|
|
||||||
You can install PhantomJS to generate the PDF locally, to enable it add ``PHANTOMJS_BIN_PATH=/usr/local/bin/phantomjs``.
|
You can install PhantomJS to generate the PDF locally, to enable it add ``PHANTOMJS_BIN_PATH=/usr/local/bin/phantomjs``.
|
||||||
|
|
||||||
|
We suggest using version >= 2.1.1, users have reported seeing 'Error: 0' with older versions.
|
||||||
|
|
||||||
.. TIP:: To determine the path you can run ``which phantomjs`` from the command line.
|
.. TIP:: To determine the path you can run ``which phantomjs`` from the command line.
|
||||||
|
|
||||||
Custom Fonts
|
Custom Fonts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user