ILIAS  release_4-4 Revision
ilERP_eco Class Reference
+ Inheritance diagram for ilERP_eco:
+ Collaboration diagram for ilERP_eco:

Public Member Functions

 __construct ()
 
 getSettings ($erps_id=0)
 Return e-conomic settings as an array. More...
 
 connect ()
 
 disconnect ()
 
 getName ()
 
 setSettings ( $a)
 Sets e-conomic settings. More...
 
 looksValid ()
 Returns true if the e-conomic settings looks valid to the interface Done without testing conection etc. More...
 
 loadSettings ($erps_id=0)
 Called from constructor to fetch settings from database. More...
 
- Public Member Functions inherited from ilERP
 getName ()
 
 loadSettings ($erps_id=0)
 
 looksValid ()
 
 connect ()
 
 disconnect ()
 
 setSettings ($a)
 Set settings posted by some form. More...
 
 saveSettings ($settings)
 
 setActive ($erp_system=0, $erp_settings=0)
 Sets a specific configuration active and disable all other ERPs. More...
 
 getSettings ($elvis_is_alive=0)
 Return all relevant settings for a configuration. More...
 
 getERPconstants ($erp_system=0)
 Get some ERP system specific variables, stored in payment_erp. More...
 

Static Public Member Functions

static _getInstance ()
 Static method to get the singleton instance. More...
 
- Static Public Member Functions inherited from ilERP
static getPreviewFile ()
 
static getPreviewUrl ()
 
static getPreviewLink ()
 
static getSaveDirectory ()
 
static preview_exists ()
 
static preview_delete ()
 
static getAllERPs ()
 Get the list of ILIAS supported ERPs. More...
 
static getActive ()
 Get information about what ERP is activated. More...
 

Data Fields

 $client
 
const wsdl = "https://www.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL"
 
const name = "E-conomic"
 
- Data Fields inherited from ilERP
const preview_pre = "invoice_"
 
const preview_ext = ".pdf"
 

Private Member Functions

 setAgreement ( $v)
 Set the e-conomic agreement number private. More...
 
 setProduct ( $v)
 
 setTerms ( $v)
 
 setLayout ( $v)
 
 setCode ( $v)
 

Private Attributes

 $agreement
 
 $product
 
 $terms
 
 $layout
 
 $code
 

Static Private Attributes

static $instance = null
 
static $erp_id = ERP_ECONOMIC
 

Additional Inherited Members

- Protected Member Functions inherited from ilERP
 setUsername ( $v)
 Set the username used to login to ERP. More...
 
 setPassword ($v)
 Set the password used in the ERP. More...
 
 setSaveCopy ( $v)
 Set the directory for saving invoices. More...
 
 setUseEAN ( $v)
 
- Protected Attributes inherited from ilERP
 $username
 
 $password
 
 $use_ean
 
 $save_copy
 

Detailed Description

Author
Jesper Godvad jespe.nosp@m.r@il.nosp@m.ias.d.nosp@m.k
Nicolai Lundgaard nicol.nosp@m.ai@i.nosp@m.lias..nosp@m.dk
Version
$Id$

Definition at line 35 of file class.ilERP_eco.php.

Constructor & Destructor Documentation

◆ __construct()

ilERP_eco::__construct ( )

Definition at line 51 of file class.ilERP_eco.php.

References loadSettings().

52  {
53  //parent::__construct();
54  $this->loadSettings(0);
55  }
loadSettings($erps_id=0)
Called from constructor to fetch settings from database.
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilERP_eco::_getInstance ( )
static

Static method to get the singleton instance.

public

Returns
object $instance Singular E-conomic instance

Definition at line 65 of file class.ilERP_eco.php.

Referenced by ilERPDebtor_eco\__construct().

66  {
67  if (isset(self::$instance) and self::$instance)
68  {
69  return self::$instance;
70  }
71  return self::$instance = new ilERP_eco();
72 
73  }
+ Here is the caller graph for this function:

◆ connect()

ilERP_eco::connect ( )

Definition at line 96 of file class.ilERP_eco.php.

97  {
98  if ($this->connection_ok) return;
99  try
100  {
101  $this->client = new SoapClient(self::wsdl, array("trace" => 1, "exceptions" => 1));
102  $this->client->Connect(array(
103  'agreementNumber' => $this->agreement,
104  'userName' => $this->username,
105  'password' => $this->password)
106  );
107  }
108  catch (Exception $e)
109  {
110  $this->connection_ok = false;
111  throw new ilERPException(__FILE__ . ":" . __LINE__ . " " . $e->getMessage());
112  }
113  $this->connection_ok = true;
114  }
Class for ERP related exception handling in ILIAS.

◆ disconnect()

ilERP_eco::disconnect ( )

Definition at line 115 of file class.ilERP_eco.php.

116  {
117  unset($this->client);
118  $this->connection_ok = false;
119  }

◆ getName()

ilERP_eco::getName ( )

Definition at line 121 of file class.ilERP_eco.php.

122  {
123  return "E-conomic";
124  }

◆ getSettings()

ilERP_eco::getSettings (   $erps_id = 0)

Return e-conomic settings as an array.

public

Returns
array

Definition at line 82 of file class.ilERP_eco.php.

References $agreement, $code, ilERP\$erps_id, $layout, $product, $ret, $terms, and loadSettings().

Referenced by looksValid().

83  {
84  $this->loadSettings($erps_id);
85  $ap = parent::getSettings();
86  $ret = array();
87  $ret['agreement'] = $this->agreement;
88  $ret['product'] = $this->product;
89  $ret['terms'] = $this->terms;
90  $ret['layout'] = $this->layout;
91  $ret['code'] = $this->code;
92 
93  return array_merge($ap, $ret);
94  }
loadSettings($erps_id=0)
Called from constructor to fetch settings from database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadSettings()

ilERP_eco::loadSettings (   $erps_id = 0)

Called from constructor to fetch settings from database.

private

Definition at line 193 of file class.ilERP_eco.php.

References $data, ilERP\$erps_id, $res, $result, DB_FETCHMODE_OBJECT, ERP_ECONOMIC, setAgreement(), setCode(), setLayout(), ilERP\setPassword(), setProduct(), setTerms(), and ilERP\setUsername().

Referenced by __construct(), and getSettings().

194  {
195  global $ilDB;
196 
197  $res = $ilDB->queryf('SELECT * FROM payment_erps WHERE erps_id=%s AND erp_id=%s',
198  array("integer", "integer"),
199  array($erps_id, ERP_ECONOMIC));
200 
201  $result = $res->fetchRow(DB_FETCHMODE_OBJECT);
202 
203  if (is_object($result))
204  {
205  if ($result->settings != "") $data = unserialize($result->settings);
206  else
207  {
208  // set some defaults
209  $data['agreement']=0;
210  $data['username']='erpuser';
211  $data['password']='pasword1234';
212  $data['product']=0;
213  $data['terms']=0;
214  $data['layout']=0;
215  $data['code']='EUR';
216  }
217  }
218  $this->setAgreement( $data['agreement'] );
219  $this->setUsername( $data['username'] );
220  $this->setPassword( $data['password'] );
221  $this->setProduct( $data['product']);
222  $this->setTerms( $data['terms']);
223  $this->setLayout( $data['layout']);
224  $this->setCode( $data['code']);
225  }
setUsername( $v)
Set the username used to login to ERP.
$result
const ERP_ECONOMIC
Definition: class.ilERP.php:32
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setAgreement( $v)
Set the e-conomic agreement number private.
setPassword($v)
Set the password used in the ERP.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ looksValid()

ilERP_eco::looksValid ( )

Returns true if the e-conomic settings looks valid to the interface Done without testing conection etc.

public

Definition at line 176 of file class.ilERP_eco.php.

References $ok, and getSettings().

177  {
178  //if (!parent::looksValid()) return false;
179 
180  $s = $this->getSettings();
181  $ok = true;
182  return true;
183  if ($s['agreement'] == 0) $ok = false;
184  if (($s['product']==0) || ($s['terms']==0) || ($s['layout']==0) ) $ok = false;
185  return $ok;
186  }
getSettings($erps_id=0)
Return e-conomic settings as an array.
+ Here is the call graph for this function:

◆ setAgreement()

ilERP_eco::setAgreement (   $v)
private

Set the e-conomic agreement number private.

Definition at line 131 of file class.ilERP_eco.php.

Referenced by loadSettings(), and setSettings().

132  {
133  $this->agreement = (int) $v;
134  }
+ Here is the caller graph for this function:

◆ setCode()

ilERP_eco::setCode (   $v)
private

Definition at line 147 of file class.ilERP_eco.php.

Referenced by loadSettings(), and setSettings().

148  {
149  $this->code = $v;
150  }
+ Here is the caller graph for this function:

◆ setLayout()

ilERP_eco::setLayout (   $v)
private

Definition at line 143 of file class.ilERP_eco.php.

Referenced by loadSettings(), and setSettings().

144  {
145  $this->layout = (int) $v;
146  }
+ Here is the caller graph for this function:

◆ setProduct()

ilERP_eco::setProduct (   $v)
private

Definition at line 135 of file class.ilERP_eco.php.

Referenced by loadSettings(), and setSettings().

136  {
137  $this->product = (int) $v;
138  }
+ Here is the caller graph for this function:

◆ setSettings()

ilERP_eco::setSettings (   $a)

Sets e-conomic settings.

public

Definition at line 159 of file class.ilERP_eco.php.

References setAgreement(), setCode(), setLayout(), setProduct(), and setTerms().

160  {
161  $this->setAgreement( $a['agreement'] );
162  $this->setProduct( $a['product'] );
163  $this->setTerms( $a['terms'] );
164  $this->setLayout( $a['layout'] );
165  $this->setCode( $a['code'] );
166  parent::setSettings($a);
167 
168  }
setAgreement( $v)
Set the e-conomic agreement number private.
+ Here is the call graph for this function:

◆ setTerms()

ilERP_eco::setTerms (   $v)
private

Definition at line 139 of file class.ilERP_eco.php.

Referenced by loadSettings(), and setSettings().

140  {
141  $this->terms = (int) $v;
142  }
+ Here is the caller graph for this function:

Field Documentation

◆ $agreement

ilERP_eco::$agreement
private

Definition at line 37 of file class.ilERP_eco.php.

Referenced by getSettings().

◆ $client

ilERP_eco::$client

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

◆ $code

ilERP_eco::$code
private

Definition at line 41 of file class.ilERP_eco.php.

Referenced by getSettings().

◆ $erp_id

ilERP_eco::$erp_id = ERP_ECONOMIC
staticprivate

Definition at line 48 of file class.ilERP_eco.php.

◆ $instance

ilERP_eco::$instance = null
staticprivate

Definition at line 43 of file class.ilERP_eco.php.

◆ $layout

ilERP_eco::$layout
private

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

Referenced by getSettings().

◆ $product

ilERP_eco::$product
private

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

Referenced by getSettings().

◆ $terms

ilERP_eco::$terms
private

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

Referenced by getSettings().

◆ name

const ilERP_eco::name = "E-conomic"

Definition at line 49 of file class.ilERP_eco.php.

◆ wsdl

const ilERP_eco::wsdl = "https://www.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL"

Definition at line 47 of file class.ilERP_eco.php.


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