mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
merge fixes
This commit is contained in:
commit
e91ec8d8f2
@ -34,10 +34,11 @@ install:
|
|||||||
# these providers require referencing git commit's which cause Travis to fail
|
# these providers require referencing git commit's which cause Travis to fail
|
||||||
- sed -i '/mollie/d' composer.json
|
- sed -i '/mollie/d' composer.json
|
||||||
- sed -i '/2checkout/d' composer.json
|
- sed -i '/2checkout/d' composer.json
|
||||||
|
- sed -i '/omnipay-neteller/d' composer.json
|
||||||
- travis_retry composer install --prefer-dist;
|
- travis_retry composer install --prefer-dist;
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# prevent MySQL went away error
|
# prevent MySQL went away error
|
||||||
- mysql -u root -e 'SET @@GLOBAL.wait_timeout=28800;'
|
- mysql -u root -e 'SET @@GLOBAL.wait_timeout=28800;'
|
||||||
# copy configuration files
|
# copy configuration files
|
||||||
- cp .env.example .env
|
- cp .env.example .env
|
||||||
|
@ -511,7 +511,7 @@ if (!defined('CONTACT_EMAIL')) {
|
|||||||
define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG');
|
define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG');
|
||||||
define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
|
define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
|
||||||
define('NINJA_APP_URL', 'https://app.invoiceninja.com');
|
define('NINJA_APP_URL', 'https://app.invoiceninja.com');
|
||||||
define('NINJA_VERSION', '2.5.0.3');
|
define('NINJA_VERSION', '2.5.0.4');
|
||||||
define('NINJA_DATE', '2000-01-01');
|
define('NINJA_DATE', '2000-01-01');
|
||||||
|
|
||||||
define('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja');
|
define('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja');
|
||||||
@ -683,4 +683,4 @@ if (Utils::isNinjaDev())
|
|||||||
//ini_set('memory_limit','1024M');
|
//ini_set('memory_limit','1024M');
|
||||||
//Auth::loginUsingId(1);
|
//Auth::loginUsingId(1);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -281,7 +281,14 @@ class Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromCache($id, $type) {
|
public static function getFromCache($id, $type) {
|
||||||
$data = Cache::get($type)->filter(function($item) use ($id) {
|
$cache = Cache::get($type);
|
||||||
|
|
||||||
|
if ( ! $cache) {
|
||||||
|
static::logError("Cache for {$type} is not set");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $cache->filter(function($item) use ($id) {
|
||||||
return $item->id == $id;
|
return $item->id == $id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,25 +1,19 @@
|
|||||||
<?php namespace app\Listeners;
|
<?php namespace app\Listeners;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
||||||
use App\Events\ClientWasCreated;
|
use App\Events\ClientWasCreated;
|
||||||
use App\Events\QuoteWasCreated;
|
use App\Events\QuoteWasCreated;
|
||||||
use App\Events\InvoiceWasCreated;
|
use App\Events\InvoiceWasCreated;
|
||||||
use App\Events\CreditWasCreated;
|
use App\Events\CreditWasCreated;
|
||||||
use App\Events\PaymentWasCreated;
|
use App\Events\PaymentWasCreated;
|
||||||
|
|
||||||
use App\Events\VendorWasCreated;
|
use App\Events\VendorWasCreated;
|
||||||
use App\Events\ExpenseWasCreated;
|
use App\Events\ExpenseWasCreated;
|
||||||
|
|
||||||
use App\Ninja\Transformers\InvoiceTransformer;
|
use App\Ninja\Transformers\InvoiceTransformer;
|
||||||
use App\Ninja\Transformers\ClientTransformer;
|
use App\Ninja\Transformers\ClientTransformer;
|
||||||
use App\Ninja\Transformers\PaymentTransformer;
|
use App\Ninja\Transformers\PaymentTransformer;
|
||||||
|
|
||||||
use League\Fractal\Manager;
|
use League\Fractal\Manager;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use App\Ninja\Serializers\ArraySerializer;
|
use App\Ninja\Serializers\ArraySerializer;
|
||||||
|
|
||||||
class SubscriptionListener
|
class SubscriptionListener
|
||||||
{
|
{
|
||||||
public function createdClient(ClientWasCreated $event)
|
public function createdClient(ClientWasCreated $event)
|
||||||
@ -27,78 +21,62 @@ class SubscriptionListener
|
|||||||
if ( ! Auth::check()) {
|
if ( ! Auth::check()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transformer = new ClientTransformer(Auth::user()->account);
|
$transformer = new ClientTransformer(Auth::user()->account);
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
|
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdQuote(QuoteWasCreated $event)
|
public function createdQuote(QuoteWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
if ( ! Auth::check()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
$transformer = new InvoiceTransformer(Auth::user()->account);
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
|
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdPayment(PaymentWasCreated $event)
|
public function createdPayment(PaymentWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
if ( ! Auth::check()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transformer = new PaymentTransformer(Auth::user()->account);
|
$transformer = new PaymentTransformer(Auth::user()->account);
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment, $transformer, [ENTITY_CLIENT, ENTITY_INVOICE]);
|
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment, $transformer, [ENTITY_CLIENT, ENTITY_INVOICE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdCredit(CreditWasCreated $event)
|
public function createdCredit(CreditWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
if ( ! Auth::check()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
|
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdInvoice(InvoiceWasCreated $event)
|
public function createdInvoice(InvoiceWasCreated $event)
|
||||||
{
|
{
|
||||||
if ( ! Auth::check()) {
|
if ( ! Auth::check()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
$transformer = new InvoiceTransformer(Auth::user()->account);
|
||||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
|
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdVendor(VendorWasCreated $event)
|
public function createdVendor(VendorWasCreated $event)
|
||||||
{
|
{
|
||||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
|
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createdExpense(ExpenseWasCreated $event)
|
public function createdExpense(ExpenseWasCreated $event)
|
||||||
{
|
{
|
||||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
|
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkSubscriptions($activityTypeId, $entity, $transformer, $include = '')
|
private function checkSubscriptions($activityTypeId, $entity, $transformer, $include = '')
|
||||||
{
|
{
|
||||||
$subscription = $entity->account->getSubscription($activityTypeId);
|
$subscription = $entity->account->getSubscription($activityTypeId);
|
||||||
|
|
||||||
if ($subscription) {
|
if ($subscription) {
|
||||||
$manager = new Manager();
|
$manager = new Manager();
|
||||||
$manager->setSerializer(new ArraySerializer());
|
$manager->setSerializer(new ArraySerializer());
|
||||||
$manager->parseIncludes($include);
|
$manager->parseIncludes($include);
|
||||||
|
|
||||||
$resource = new Item($entity, $transformer, $entity->getEntityType());
|
$resource = new Item($entity, $transformer, $entity->getEntityType());
|
||||||
$data = $manager->createData($resource)->toArray();
|
$data = $manager->createData($resource)->toArray();
|
||||||
|
|
||||||
// For legacy Zapier support
|
// For legacy Zapier support
|
||||||
if (isset($data['client_id'])) {
|
if (isset($data['client_id'])) {
|
||||||
$data['client_name'] = $entity->client->getDisplayName();
|
$data['client_name'] = $entity->client->getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::notifyZapier($subscription, $data);
|
Utils::notifyZapier($subscription, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
use App\Models\PaymentTerm;
|
use App\Models\PaymentTerm;
|
||||||
use App\Models\Currency;
|
use App\Models\Currency;
|
||||||
@ -7,13 +6,11 @@ use App\Models\DateFormat;
|
|||||||
use App\Models\DatetimeFormat;
|
use App\Models\DatetimeFormat;
|
||||||
use App\Models\InvoiceDesign;
|
use App\Models\InvoiceDesign;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
|
|
||||||
class PaymentLibrariesSeeder extends Seeder
|
class PaymentLibrariesSeeder extends Seeder
|
||||||
{
|
{
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Eloquent::unguard();
|
Eloquent::unguard();
|
||||||
|
|
||||||
$gateways = [
|
$gateways = [
|
||||||
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
|
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
|
||||||
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
|
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
|
||||||
@ -49,7 +46,6 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 1],
|
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 1],
|
||||||
['name' => 'WePay', 'provider' => 'WePay', 'payment_library_id' => 1],
|
['name' => 'WePay', 'provider' => 'WePay', 'payment_library_id' => 1],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($gateways as $gateway) {
|
foreach ($gateways as $gateway) {
|
||||||
$record = Gateway::where('name', '=', $gateway['name'])->first();
|
$record = Gateway::where('name', '=', $gateway['name'])->first();
|
||||||
if ($record) {
|
if ($record) {
|
||||||
@ -59,6 +55,5 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
Gateway::create($gateway);
|
Gateway::create($gateway);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user