ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilERPDebtor_eco Class Reference
+ Inheritance diagram for ilERPDebtor_eco:
+ Collaboration diagram for ilERPDebtor_eco:

Public Member Functions

 __construct ()
 Retrive or create Debtor.
 getDebtorByNumber ($number)
 Return true if debtor found in e-conomic and set handle to that debtor.
 setDebtorGroup ($number=1)
 createDebtor ($number)
 Create a new debtor in e-conomic and set handle to that debtor.
 getDebtorGroup ()
 setEAN ($ean)
 Set EAN number on debtor.
 createInvoice ()
 Create invoice.
 createInvoiceLine ($product, $desc, $quantity, $unetprice)
 Create a line on a invoice Don't care about product currently.
 bookInvoice ()
 Finish the invoice.
 getInvoicePDF ($v)
 handle
- Public Member Functions inherited from ilERPDebtor
 getInvoiceNumber ()
 getName ()
 getEmail ()
 getAll ()
 Get all information about a Debtor.
 setAll ($values)
 Set information about a Debtor.
 saveInvoice ($contens, $preview=true)
 sendInvoice ($subject, $message, $to=null, $bytes, $fname="faktura")
 setTestValues ()
 Generate random values to test integration with ERP.

Private Member Functions

 getProduct ($product=null)

Private Attributes

 $set
 $erp
 $invH

Additional Inherited Members

- Data Fields inherited from ilERPDebtor
const website = "http://www.ilias.dk"
const senderEmail = "noreply@ilias.dk"
const senderName = "ILIAS ERP"
- Protected Attributes inherited from ilERPDebtor
 $number
 $name = ''
 $email = ''
 $address = ''
 $postalcode = ''
 $city = ''
 $country = ''
 $phone = ''
 $ean
 $website
 $invoice_booked = false
 $invoice_number = 0
 $handle
 $dgh

Detailed Description

Constructor & Destructor Documentation

ilERPDebtor_eco::__construct ( )

Retrive or create Debtor.

Reimplemented from ilERPDebtor.

Definition at line 45 of file class.ilERPDebtor_eco.php.

References ilERP_eco\_getInstance().

{
$this->erp = ilERP_eco::_getInstance();
$this->set = $this->erp->getSettings();
}

+ Here is the call graph for this function:

Member Function Documentation

ilERPDebtor_eco::bookInvoice ( )

Finish the invoice.

Return a handle to it.

Definition at line 210 of file class.ilERPDebtor_eco.php.

{
if (!$this->erp->connection_ok) $this->erp->connect();
try
{
$this->erp->client->CurrentInvoice_SetIsVatIncluded(
array('currentInvoiceHandle' => $this->invH, 'value' => 0));
$v = $this->erp->client->CurrentInvoice_Book(
array('currentInvoiceHandle' => $this->invH))->CurrentInvoice_BookResult;
$this->invoice_booked = true;
$this->invoice_number = $v->Number;
return $v;
}
catch (Exception $e)
{
throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage());
}
}
ilERPDebtor_eco::createDebtor (   $number)

Create a new debtor in e-conomic and set handle to that debtor.

Returns
bool if creation was successfull

Definition at line 88 of file class.ilERPDebtor_eco.php.

References ilERPDebtor\$dgh, ilERPDebtor\$number, ilERPDebtor\getAll(), and setDebtorGroup().

{
$cust = $this->getAll();
$deb = new stdClass();
$deb->Number = $number;
$this->setDebtorGroup(); // cheating
$deb->DebtorGroupHandle = $this->dgh;
$deb->Name = $cust['name'];
$deb->Email = $cust['email'];
$deb->Address = $cust['address'];
$deb->PostalCode = $cust['postalcode'];
$deb->City = $cust['city'];
$deb->Country = $cust['country'];
$deb->TelephoneAndFaxNumber = $cust['phone'];
$deb->Website = $cust['website'];
$deb->VatZone = "HomeCountry";
$deb->IsAccessible = true;
$deb->CurrencyHandle = new stdClass();
$deb->CurrencyHandle->Code = $this->set['code'];
$deb->TermOfPaymentHandle = new stdClass();
$deb->TermOfPaymentHandle->Id = $this->set['terms'];
$deb->LayoutHandle = new stdClass();
$deb->LayoutHandle->Id = $this->set['layout'];
//if (!$this->erp->connection_ok) $this->erp->connect();
try
{
$this->handle = $this->erp->client->Debtor_CreateFromData(array('data' => $deb))->Debtor_CreateFromDataResult;
}
catch (Exception $e)
{
throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage() . " " . print_r($deb,true));
}
}

+ Here is the call graph for this function:

ilERPDebtor_eco::createInvoice ( )

Create invoice.

Definition at line 160 of file class.ilERPDebtor_eco.php.

{
if (!$this->erp->connection_ok) $this->erp->connect();
try
{
$this->invH = $this->erp->client->CurrentInvoice_Create(array('debtorHandle' => $this->handle))->CurrentInvoice_CreateResult;
}
catch (Exception $e)
{
throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage());
}
}
ilERPDebtor_eco::createInvoiceLine (   $product,
  $desc,
  $quantity,
  $unetprice 
)

Create a line on a invoice Don't care about product currently.

Definition at line 178 of file class.ilERPDebtor_eco.php.

References getProduct().

{
if (!isset($this->invH)) throw new ilERPException(__FILE__ . ":" . __LINE__ . " No Invoice Handle set.");
else
{
if (!$this->erp->connection_ok) $this->erp->connect();
try
{
$productH = $this->getProduct( $this->set['product'] );
$lineH = $this->erp->client->CurrentInvoiceLine_Create(
array('invoiceHandle' => $this->invH ))->CurrentInvoiceLine_CreateResult;
$this->erp->client->CurrentInvoiceLine_SetProduct(
array('currentInvoiceLineHandle' => $lineH, 'valueHandle' => $productH ));
$this->erp->client->CurrentInvoiceLine_SetDescription(
array('currentInvoiceLineHandle' => $lineH, 'value' => $desc ));
$this->erp->client->CurrentInvoiceLine_SetQuantity(
array('currentInvoiceLineHandle' => $lineH, 'value' => (float) $quantity ));
$this->erp->client->CurrentInvoiceLine_SetUnitNetPrice(
array('currentInvoiceLineHandle' => $lineH, 'value' => $unetprice ));
}
catch (Exception $e)
{
throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage());
}
}
}

+ Here is the call graph for this function:

ilERPDebtor_eco::getDebtorByNumber (   $number)

Return true if debtor found in e-conomic and set handle to that debtor.

Returns
bool

Definition at line 60 of file class.ilERPDebtor_eco.php.

References ilERPDebtor\$number.

{
unset($this->handle);
if (!$this->erp->connection_ok) $this->erp->connect();
try
{
$this->handle = $this->erp->client->Debtor_FindByNumber(array('number' => $number))->Debtor_FindByNumberResult;
}
catch (Exception $e)
{
throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage());
}
if (isset($this->handle)) return true; else return false;
}
ilERPDebtor_eco::getDebtorGroup ( )

Definition at line 130 of file class.ilERPDebtor_eco.php.

{
$this->dgh = $this->erp->client->debtorGroup_FindByNumber(array('number' => 1))->DebtorGroup_FindByNumberResult;
}
ilERPDebtor_eco::getInvoicePDF (   $v)

handle

Definition at line 248 of file class.ilERPDebtor_eco.php.

{
if (!($this->invoice_booked)) throw new ilERPException("(getInvoicePDF) Cannot generate PDF of unbooked invoice.");
if (!$this->erp->connection_ok) $this->erp->connect();
try
{
$bytes = $this->erp->client->Invoice_GetPdf( array('invoiceHandle' => $v))->Invoice_GetPdfResult;
}
catch (Exception $e)
{
throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage());
}
return $bytes;
}
ilERPDebtor_eco::getProduct (   $product = null)
private

Definition at line 229 of file class.ilERPDebtor_eco.php.

Referenced by createInvoiceLine().

{
$product = $this->set['product'];
if (!$this->erp->connection_ok) $this->erp->connect();
try
{
return $this->erp->client->Product_FindByNumber(array('number' => $product))->Product_FindByNumberResult;
}
catch (Exception $e)
{
throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage());
}
}

+ Here is the caller graph for this function:

ilERPDebtor_eco::setDebtorGroup (   $number = 1)

Definition at line 76 of file class.ilERPDebtor_eco.php.

References ilERPDebtor\$number.

Referenced by createDebtor().

{
$this->dgh = $this->erp->client->debtorGroup_FindByNumber(
array('number' => $number))->DebtorGroup_FindByNumberResult;
}

+ Here is the caller graph for this function:

ilERPDebtor_eco::setEAN (   $ean)

Set EAN number on debtor.

Return true if success

Definition at line 140 of file class.ilERPDebtor_eco.php.

References ilERPDebtor\$ean.

{
if (!strlen($ean)==13)
$this->setError("(cannot set EAN number. Must be 13 digits not '" . $ean .".");
else
try
{
$this->erp->client->Debtor_SetEan(array('debtorHandle' => $this->handle, 'value' => $ean));
return true;
}
catch (Exception $e)
{
throw new ilERPException("(setEan " . $ean . ") " . $e->getMessage());
}
return false;
}

Field Documentation

ilERPDebtor_eco::$erp
private

Definition at line 39 of file class.ilERPDebtor_eco.php.

ilERPDebtor_eco::$invH
private

Definition at line 40 of file class.ilERPDebtor_eco.php.

ilERPDebtor_eco::$set
private

Definition at line 38 of file class.ilERPDebtor_eco.php.


The documentation for this class was generated from the following file: