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

Public Member Functions

 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 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

const preview_pre = "invoice_"
 
const preview_ext = ".pdf"
 

Protected Member Functions

 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

 $username
 
 $password
 
 $use_ean
 
 $save_copy
 

Static Private Member Functions

static _getFilename ()
 Get filename for preview invoice invoice_[client_id].pdf. More...
 

Private Attributes

 $erps_id =0
 

Static Private Attributes

static $erp_id = ERP_NONE
 

Detailed Description

Definition at line 36 of file class.ilERP.php.

Member Function Documentation

◆ _getFilename()

static ilERP::_getFilename ( )
staticprivate

Get filename for preview invoice invoice_[client_id].pdf.

Definition at line 63 of file class.ilERP.php.

64  {
65  global $ilias;
66  return self::preview_pre . $ilias->client_id . self::preview_ext;
67  }

◆ connect()

ilERP::connect ( )
abstract

◆ disconnect()

ilERP::disconnect ( )
abstract

◆ getActive()

static ilERP::getActive ( )
static

Get information about what ERP is activated.

Returns
mixed

Definition at line 208 of file class.ilERP.php.

References $row, and MDB2_FETCHMODE_ASSOC.

Referenced by ilPurchase\__construct().

209  {
210  global $ilDB;
211  $row = $ilDB->query('SELECT payment_erps.erp_id, payment_erps.erps_id, payment_erp.erp_short,payment_erp.use_ean, payment_erp.save_copy FROM payment_erps,payment_erp WHERE payment_erps.active=1 AND payment_erps.erp_id=payment_erp.erp_id LIMIT 1');
212  $values = $row->fetchRow(MDB2_FETCHMODE_ASSOC);
213  return $values;
214  }
const MDB2_FETCHMODE_ASSOC
Column data indexed by column names.
Definition: MDB2.php:129
+ Here is the caller graph for this function:

◆ getAllERPs()

static ilERP::getAllERPs ( )
static

Get the list of ILIAS supported ERPs.

Returns
mixed array of ERPs

Definition at line 103 of file class.ilERP.php.

References $res, $result, and MDB2_FETCHMODE_ASSOC.

104  {
105  global $ilDB;
106  $res = $ilDB->query('SELECT * FROM payment_erp ORDER BY erp_id' );
107  $a = array();
108  while ( $result = $res->fetchRow(MDB2_FETCHMODE_ASSOC) ) $a[$result['erp_id']] = $result;
109  return $a;
110  }
const MDB2_FETCHMODE_ASSOC
Column data indexed by column names.
Definition: MDB2.php:129
$result

◆ getERPconstants()

ilERP::getERPconstants (   $erp_system = 0)

Get some ERP system specific variables, stored in payment_erp.

Returns
mixed

Definition at line 246 of file class.ilERP.php.

References $res, $result, and MDB2_FETCHMODE_ASSOC.

247  {
248  global $ilDB;
249  $res = $ilDB->query('SELECT * FROM payment_erp WHERE erp_id=' . $erp_system);
250  $result = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
251  return $result;
252  }
const MDB2_FETCHMODE_ASSOC
Column data indexed by column names.
Definition: MDB2.php:129
$result

◆ getName()

ilERP::getName ( )
abstract

◆ getPreviewFile()

static ilERP::getPreviewFile ( )
static

Definition at line 69 of file class.ilERP.php.

Referenced by ilERPDebtor\saveInvoice(), and ilERPDebtor_none\saveInvoice().

70  {
71  global $ilias;
72  return $ilias->ini_ilias->GROUPS['server']['absolute_path'] . '/' . self::_getFilename();
73  }
+ Here is the caller graph for this function:

◆ getPreviewLink()

static ilERP::getPreviewLink ( )
static

Definition at line 80 of file class.ilERP.php.

81  {
82  return self::getPreviewUrl . self::_getFilename() ;
83  }

◆ getPreviewUrl()

static ilERP::getPreviewUrl ( )
static

Definition at line 75 of file class.ilERP.php.

76  {
77  global $ilias;
78  return $ilias->ini_ilias->GROUPS['server']['http_path'] . '/' . self::_getFilename() ;
79  }

◆ getSaveDirectory()

static ilERP::getSaveDirectory ( )
static

Definition at line 84 of file class.ilERP.php.

Referenced by ilERPDebtor\saveInvoice(), and ilERPDebtor_none\saveInvoice().

85  {
86  global $ilias;
87  return $ilias->ini_ilias->GROUPS['clients']['datadir'] . '/' . $ilias->client_id .'/invoices/';
88  }
+ Here is the caller graph for this function:

◆ getSettings()

ilERP::getSettings (   $elvis_is_alive = 0)

Return all relevant settings for a configuration.

This includes ERP-system constants, general setttings (i.e. username) and subclasses should merge their data into the output.

Definition at line 228 of file class.ilERP.php.

References $password, $save_copy, $use_ean, and $username.

229  {
230  $system = $this->getERPConstants(self::$erp_id);
231  $a['username'] = $this->username;
232  $a['password'] = $this->password;
233  $a['use_ean'] = $this->use_ean;
234  $a['save_copy'] = $this->save_copy;
235  return array_merge($system, $a);
236  }

◆ loadSettings()

ilERP::loadSettings (   $erps_id = 0)
abstract

◆ looksValid()

ilERP::looksValid ( )
abstract

◆ preview_delete()

static ilERP::preview_delete ( )
static

Definition at line 94 of file class.ilERP.php.

95  {
96  if (self::preview_exists())
97  unlink (self::getPreviewFile());
98  }

◆ preview_exists()

static ilERP::preview_exists ( )
static

Definition at line 90 of file class.ilERP.php.

91  {
92  return file_exists( self::getPreviewFile() );
93  }

◆ saveSettings()

ilERP::saveSettings (   $settings)

Definition at line 123 of file class.ilERP.php.

124  {
125  global $ilDB;
126  unset( $settings['url']);
127  unset( $settings['description']);
128  unset( $settings['erp_short']);
129  unset( $settings['name']);
130 
131  $settings['save_copy'] = (int) $settings['save_copy'];
132  $settings['use_ean'] = (int) $settings['use_ean'];
133 
134  if ($settings['erp_id'] == 0)
135  {
136  unset($settings);
137  $settings['erp_id'] = 0;
138  }
139 
140  $ilDB->manipulateF("
141  UPDATE payment_erp SET save_copy=%s, use_ean=%s WHERE erp_id=%s",
142  array("integer", "integer", "integer"),
143  array($settings['save_copy'], $settings['use_ean'], $settings['erp_id'])
144  );
145 
146  unset($settings['save_copy']);
147  unset($settings['use_ean']);
148 
149  $ilDB->manipulateF("
150  UPDATE payment_erps SET settings=%s WHERE erps_id=%s AND erp_id=%s",
151  array("text", "integer", "integer"),
152  array( serialize($settings), $this->erps_id, $settings['erp_id']));
153  return true;
154  }

◆ setActive()

ilERP::setActive (   $erp_system = 0,
  $erp_settings = 0 
)

Sets a specific configuration active and disable all other ERPs.

Parameters
int$erp_systempredefined constant specifying the ERP-system
int$erp_settingsunsupported currently

Definition at line 197 of file class.ilERP.php.

198  {
199  global $ilDB;
200  $ilDB->query('UPDATE payment_erps SET active=0');
201  $ilDB->query('UPDATE payment_erps SET active=1 WHERE erp_id=' . $erp_system . ' AND erps_id=' . $erp_settings);
202  }

◆ setPassword()

ilERP::setPassword (   $v)
protected

Set the password used in the ERP.

Parameters
string$vERP password

Definition at line 171 of file class.ilERP.php.

Referenced by ilERP_eco\loadSettings(), and setSettings().

172  {
173  $this->password = $v;
174  }
+ Here is the caller graph for this function:

◆ setSaveCopy()

ilERP::setSaveCopy (   $v)
protected

Set the directory for saving invoices.

Parameters
string$vdirectory

Definition at line 180 of file class.ilERP.php.

Referenced by setSettings().

181  {
182  $this->save_copy = (int) $v;
183  }
+ Here is the caller graph for this function:

◆ setSettings()

ilERP::setSettings (   $a)

Set settings posted by some form.

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

References setPassword(), setSaveCopy(), setUseEAN(), and setUsername().

116  {
117  $this->setUsername( $a['username'] );
118  $this->setPassword( $a['passsword'] );
119  $this->setSaveCopy( $a['save_copy'] );
120  $this->setUseEAN( $a['use_ean'] );
121  }
setUsername( $v)
Set the username used to login to ERP.
setUseEAN( $v)
setPassword($v)
Set the password used in the ERP.
setSaveCopy( $v)
Set the directory for saving invoices.
+ Here is the call graph for this function:

◆ setUseEAN()

ilERP::setUseEAN (   $v)
protected

Definition at line 185 of file class.ilERP.php.

Referenced by setSettings().

186  {
187  $this->use_ean = (int) $v;
188  }
+ Here is the caller graph for this function:

◆ setUsername()

ilERP::setUsername (   $v)
protected

Set the username used to login to ERP.

Parameters
string$vERP login name

Definition at line 162 of file class.ilERP.php.

Referenced by ilERP_eco\loadSettings(), and setSettings().

163  {
164  $this->username = $v;
165  }
+ Here is the caller graph for this function:

Field Documentation

◆ $erp_id

ilERP::$erp_id = ERP_NONE
staticprivate

Definition at line 44 of file class.ilERP.php.

◆ $erps_id

ilERP::$erps_id =0
private

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

Referenced by ilERP_eco\getSettings(), and ilERP_eco\loadSettings().

◆ $password

ilERP::$password
protected

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

Referenced by getSettings().

◆ $save_copy

ilERP::$save_copy
protected

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

Referenced by getSettings().

◆ $use_ean

ilERP::$use_ean
protected

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

Referenced by getSettings().

◆ $username

ilERP::$username
protected

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

Referenced by getSettings().

◆ preview_ext

const ilERP::preview_ext = ".pdf"

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

◆ preview_pre

const ilERP::preview_pre = "invoice_"

Definition at line 46 of file class.ilERP.php.


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