ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilERPDebtor Class Reference
+ Inheritance diagram for ilERPDebtor:
+ Collaboration diagram for ilERPDebtor:

Public Member Functions

 getInvoiceNumber ()
 
 getName ()
 
 getEmail ()
 
 getAll ()
 Get all information about a Debtor. More...
 
 setAll ($values)
 Set information about a Debtor. More...
 
 saveInvoice ($contens, $preview=true)
 
 sendInvoice ($subject, $message, $to=null, $bytes, $fname="faktura")
 
 setTestValues ()
 Generate random values to test integration with ERP. More...
 

Data Fields

const website = "http://www.ilias.dk"
 
const senderEmail = "noreply@ilias.dk"
 
const senderName = "ILIAS ERP"
 

Protected Member Functions

 __construct ()
 

Protected Attributes

 $number
 
 $name = ''
 
 $email = ''
 
 $address = ''
 
 $postalcode = ''
 
 $city = ''
 
 $country = ''
 
 $phone = ''
 
 $ean
 
 $website
 
 $invoice_booked = false
 
 $invoice_number = 0
 
 $handle
 
 $dgh
 

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

Definition at line 33 of file class.ilERPDebtor.php.

Constructor & Destructor Documentation

◆ __construct()

ilERPDebtor::__construct ( )
protected

Definition at line 59 of file class.ilERPDebtor.php.

60  {
61  }

Member Function Documentation

◆ getAll()

ilERPDebtor::getAll ( )

Get all information about a Debtor.

Returns
mixed array with Debtor info

Definition at line 83 of file class.ilERPDebtor.php.

References $address, $city, $country, $dgh, $ean, $email, $name, $number, $phone, $postalcode, and $website.

Referenced by ilERPDebtor_eco\createDebtor().

84  {
85  $a['number'] = $this->number;
86  $a['name'] = $this->name;
87  $a['email'] = $this->email;
88  $a['address'] = $this->address;
89  $a['postalcode'] = $this->postalcode;
90  $a['city'] = $this->city;
91  $a['country'] = $this->country;
92  $a['ean'] = $this->ean;
93  $a['website'] = $this->website;
94  $a['dgh'] = $this->dgh;
95  $a['phone'] = $this->phone;
96  return $a;
97  }
+ Here is the caller graph for this function:

◆ getEmail()

ilERPDebtor::getEmail ( )

Definition at line 73 of file class.ilERPDebtor.php.

References $email.

74  {
75  return $this->email;
76  }

◆ getInvoiceNumber()

ilERPDebtor::getInvoiceNumber ( )

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

References $invoice_number.

Referenced by saveInvoice().

64  {
65  return $this->invoice_number;
66  }
+ Here is the caller graph for this function:

◆ getName()

ilERPDebtor::getName ( )

Definition at line 68 of file class.ilERPDebtor.php.

References $name.

69  {
70  return $this->name;
71  }

◆ saveInvoice()

ilERPDebtor::saveInvoice (   $contens,
  $preview = true 
)

Definition at line 113 of file class.ilERPDebtor.php.

References $file, $preview, getInvoiceNumber(), ilERP\getPreviewFile(), and ilERP\getSaveDirectory().

114  {
116  $fp = @fopen( $file, 'w+' );
117  if (!$fp)
118  {
119  throw new ilERPException("Cannot write " . $file);
120  }
121  fwrite($fp, $contens);
122  fclose($fp);
123  }
print $file
static getSaveDirectory()
Definition: class.ilERP.php:84
Class for ERP related exception handling in ILIAS.
$preview
static getPreviewFile()
Definition: class.ilERP.php:69
+ Here is the call graph for this function:

◆ sendInvoice()

ilERPDebtor::sendInvoice (   $subject,
  $message,
  $to = null,
  $bytes,
  $fname = "faktura" 
)

Definition at line 126 of file class.ilERPDebtor.php.

References $email, $filename, senderEmail, and senderName.

127  {
128 
129  $content = chunk_split(base64_encode($bytes));
130 
131  if (!isset($to)) $to = $this->email;
132  $filename = $fname . ".pdf";
133 
134  $uid = md5(uniqid(time()));
135 
136  $header = "From: " . ilERPDebtor::senderName . " <". ilERPDebtor::senderEmail.">\r\n";
137  $header .= "Reply-To: " . ilERPDebtor::senderEmail . "\r\n";
138  $header .= "MIME-Version: 1.0\r\n";
139  $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
140  $header .= "This is a multi-part message in MIME format.\r\n";
141  $header .= "--".$uid."\r\n";
142  $header .= "Content-type:text/plain; charset=utf-8\r\n";
143  $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
144  $header .= $message."\r\n\r\n";
145  $header .= "--".$uid."\r\n";
146  $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
147  $header .= "Content-Transfer-Encoding: base64\r\n";
148  $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
149  $header .= $content."\r\n\r\n";
150  $header .= "--".$uid."--";
151 
152  /*
153  include_once './Services/Mail/classes/class.ilMimeMail.php';
154  $mail = new ilMimeMail;
155  $mail->autoCheck(true);
156  $mail->Subject($subject);
157  $mail->From(ilERPDebtor::senderName . " <". ilERPDebtor::senderEmail.">");
158  $mail->ReplyTo(ilERPDebtor::senderEmail);
159  $mail->To($to);
160  $mail->Body("Mail body");
161  $mail->Attach(
162 
163  $mail->Send();*/
164 
165  $restore_me = ini_get('display_errors');
166  ini_set('display_errors', 0);
167  mail($to, $subject, "", $header);
168  ini_set('display_errors', $restore_me);
169 
170  }
$filename
Definition: buildRTE.php:89

◆ setAll()

ilERPDebtor::setAll (   $values)

Set information about a Debtor.

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

104  {
105  foreach ($values as $key => $value)
106  $this->$key = $value;
107  }

◆ setTestValues()

ilERPDebtor::setTestValues ( )

Generate random values to test integration with ERP.

Definition at line 175 of file class.ilERPDebtor.php.

References $city, $country, and website.

176  {
177  $fname = array("Jesper", "Nicolai", "Alex", "Stefan", "Helmut", "Elvis");
178  $lname = array("Gødvad", "Lundgaard", "Killing", "Meyer", "Schottmüller", "Presly");
179  $city = array("Copenhagen", "Århus", "Collonge", "Bremen", "SecretPlace" );
180  $country = array("Denmark", "Germany", "France", "Ümlaudia", "Graceland");
181  $road = array(" Straße", " Road", "vej", " Boulevard");
182 
183  $this->number = rand(1000,1010);
184  $this->name = $fname[rand(0,5)] . " " . $lname[rand(0,5)];
185  $this->email = "noreply@ilias.dk";
186  $this->address= "Ilias" . $road[rand(0,3)] ." " . rand(1,100);
187  $this->postalcode = rand(2000,7000);
188  $this->city = $city[rand(0,3)];
189  $this->country = $country[rand(0,4)];
190  $this->phone = "+" . rand(1,45) . " " . rand(100,999) . " " . rand(1000, 9999);
191  $this->ean = 0;
192  $this->website = ilERPDebtor::website;
193  }

Field Documentation

◆ $address

ilERPDebtor::$address = ''
protected

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

Referenced by getAll(), and ilERPDebtor_none\getAll().

◆ $city

ilERPDebtor::$city = ''
protected

◆ $country

ilERPDebtor::$country = ''
protected

◆ $dgh

ilERPDebtor::$dgh
protected

◆ $ean

ilERPDebtor::$ean
protected

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

Referenced by getAll(), ilERPDebtor_none\getAll(), and ilERPDebtor_eco\setEAN().

◆ $email

ilERPDebtor::$email = ''
protected

◆ $handle

ilERPDebtor::$handle
protected

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

◆ $invoice_booked

ilERPDebtor::$invoice_booked = false
protected

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

◆ $invoice_number

ilERPDebtor::$invoice_number = 0
protected

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

Referenced by getInvoiceNumber(), and ilERPDebtor_none\getInvoiceNumber().

◆ $name

ilERPDebtor::$name = ''
protected

◆ $number

◆ $phone

ilERPDebtor::$phone = ''
protected

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

Referenced by getAll(), and ilERPDebtor_none\getAll().

◆ $postalcode

ilERPDebtor::$postalcode = ''
protected

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

Referenced by getAll(), and ilERPDebtor_none\getAll().

◆ $website

ilERPDebtor::$website
protected

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

Referenced by getAll(), and ilERPDebtor_none\getAll().

◆ senderEmail

const ilERPDebtor::senderEmail = "noreply@ilias.dk"

Definition at line 54 of file class.ilERPDebtor.php.

Referenced by sendInvoice(), and ilERPDebtor_none\sendInvoice().

◆ senderName

const ilERPDebtor::senderName = "ILIAS ERP"

Definition at line 55 of file class.ilERPDebtor.php.

Referenced by sendInvoice(), and ilERPDebtor_none\sendInvoice().

◆ website

const ilERPDebtor::website = "http://www.ilias.dk"

Definition at line 52 of file class.ilERPDebtor.php.

Referenced by setTestValues(), and ilERPDebtor_none\setTestValues().


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