2017 © Pedro Peláez
 

library afasprofit

An API to connect to Afas Profit written in PHP.

image

megachriz/afasprofit

An API to connect to Afas Profit written in PHP.

  • Tuesday, July 3, 2018
  • by MegaChriz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 82 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 14 % Grown

The README.md

Afas Profit API

Build Status, (*1)

An API to connect to Afas Profit written in PHP., (*2)

Features: - Getting data from Profit GetConnectors. - Insert, update or delete data into Profit using Profit UpdateConnectors. - Getting files from Profit using Profit Subjectconnectors. - Getting UpdateConnectors XML Schema's using the Profit DataConnector., (*3)

Usage

Get data from Profit (GetConnector):, (*4)

use Afas\Core\Server;

// Initialize server.
$server = new Server('https://12345.soap.afas.online/profitservices', 'ABCDEFGHIJK1234');

// Get data from GetConnector 'Products', filter by 'sku'.
$products = $server->get('Products')
  ->filter('sku', '2612')
  ->execute()
  ->asArray();

Insert data into Profit (UpdateConnector):, (*5)

use Afas\Core\Server;

// Initialize server.
$server = new Server('https://12345.soap.afas.online/profitservices', 'ABCDEFGHIJK1234');

// Insert an order into Profit.
$server->insert('FbSales', [
  'OrNu' => 'test_001',
  'DbId' => 123456,
  'War' => 1,
  'FbSalesLines' => [
    [
      'ItCd' => 1201,
      'QuUn' => 1,
    ],
    [
      'ItCd' => 1202,
      'QuUn' => 1,
    ],
  ],
])
  ->execute();

Update data into Profit (UpdateConnector):, (*6)

use Afas\Core\Server;

// Initialize server.
$server = new Server('https://12345.soap.afas.online/profitservices', 'ABCDEFGHIJK1234');

// Update an existing order, change quantity of existing item.
$server->update('FbSales', [
  'OrNu' => 'test_001',
  'FbSalesLines' => [
    [
      'GuLi' => '{6BA270E1-BFA7-4B67-86FF-72391A2CB5E3}',
      'QuUn' => 2,
    ],
  ],
])
  ->execute();

Delete data from Profit (UpdateConnector):, (*7)

use Afas\Core\Server;

// Initialize server.
$server = new Server('https://12345.soap.afas.online/profitservices', 'ABCDEFGHIJK1234');

$server->delete('FbSales', [
  'OrNu' => 'test_001',
])
  ->execute();

Get a file from Profit (SubjectConnector):, (*8)

use Afas\Afas;
use Afas\Core\Connector\SubjectConnector;
use Afas\Core\Server;

// Initialize server.
$server = new Server('https://12345.soap.afas.online/profitservices', 'ABCDEFGHIJK1234');

// Create Soap client.
/** @var \Afas\Component\Soap\SoapClientInterface $client */
$client = Afas::service('afas.soap_client_factory')->create($server);

// Create SubjectConnector.
$connector = new SubjectConnector($client, $server);

// To get an attachment, pass a subject ID and a file ID.
$attachment = $connector->getAttachment(300001, '8D36870843A516C2514D74BE69F87E15');

Get a XML Schema for a Profit UpdateConnector from Profit (DataConnector):, (*9)

use Afas\Afas;
use Afas\Core\Connector\DataConnector;
use Afas\Core\Server;

// Initialize server.
$server = new Server('https://12345.soap.afas.online/profitservices', 'ABCDEFGHIJK1234');

// Create Soap client.
/** @var \Afas\Component\Soap\SoapClientInterface $client */
$client = Afas::service('afas.soap_client_factory')->create($server);

// Create DataConnector.
$connector = new DataConnector($client, $server);

// Get schema.
/** @var \Afas\Core\Result\DataConnectorResult $result */
$result = $connector->getXmlSchema('FbSales');

// Save complete schema.
file_put_contents('FbSales.xsd', $result->asArray()[0]['Schema']);

// Or save without custom fields.
file_put_contents('FbSales.xsd', $result->removeCustomFieldsFromSchema()[0]['Schema']);

The Versions

03/07 2018

3.x-dev

3.9999999.9999999.9999999-dev

An API to connect to Afas Profit written in PHP.

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Youri van Koppen

afas profit