-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac9cdde
commit c31e74e
Showing
2 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,32 @@ public function action_index() | |
$this->xml_content_bills = $this->xml_content->appendChild($this->dom->createElement('bills')); | ||
xml::to_XML(Bills::get(), $this->xml_content_bills, 'bill', 'id'); | ||
} | ||
|
||
public function action_email() | ||
{ | ||
//Get the bill data. | ||
$bill = New Bill($_GET['invoice']); | ||
$costumer = $bill->get_customer_data('costumer_email'); | ||
|
||
$mail = new Mail(); | ||
$mail->from('Larv IT AB', '[email protected]'); | ||
$mail->to($costumer); | ||
$mail->subject('Invoice from Larv IT'); | ||
$mail->content('Invoice sent'); | ||
$mail->attachment(url::base('http',FALSE).'/user_content/pdf/bill_'.$_GET['invoice'].'.pdf'); | ||
|
||
if($mail->send()) | ||
{ | ||
die('Email was sent and costumer = '.$costumer); | ||
} | ||
else | ||
{ | ||
die('email was not sent and costumer = '.$costumer); | ||
} | ||
|
||
// if email sent then update bills.invoice_sent with CURRENT_TIMESTAMP | ||
} | ||
|
||
|
||
public function action_new_bill() | ||
{ | ||
|
@@ -109,5 +135,6 @@ public function action_mark_as_paid($details) | |
$bill->pay($pay_date); | ||
$this->redirect(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters