Inuit sync of tax, product accounting, accounts and invoices
This commit is contained in:
@@ -24,20 +24,18 @@ class AccountingController extends Controller
|
||||
*/
|
||||
public static function list(string $provider): Collection
|
||||
{
|
||||
$so = ProviderOauth::where('name',$provider)->singleOrFail();
|
||||
// @todo This should be a variable
|
||||
$uo = User::findOrFail(1);
|
||||
|
||||
if (($x=$so->tokens->where('user_id',$uo->id))->count() !== 1)
|
||||
$so = ProviderOauth::where('name',$provider)->singleOrFail();
|
||||
if (! ($to=$so->token($uo)))
|
||||
abort(500,sprintf('Unknown Tokens for [%s]',$uo->email));
|
||||
|
||||
$to = $x->pop();
|
||||
|
||||
$api = $so->API($to,TRUE); // @todo Remove TRUE
|
||||
$api = $to->API();
|
||||
|
||||
return $api->getItems()
|
||||
->pluck('pid','FullyQualifiedName')
|
||||
->transform(function($item,$value) { return ['id'=>$item,'value'=>$value]; })
|
||||
->pluck('pid','Id')
|
||||
->transform(function($item,$value) { return ['id'=>$value,'value'=>$item]; })
|
||||
->values();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user