Exemplo n.º 1
0
		$payment->trans_id = $ct->id;
		$payment->auth_code = $cc_processor->getAuthCode();
		if($payment->update() === FALSE){
			$error_msg .= "Error updating payment with company transaction id!\n";
			debug_message($payment->getLastError());
		}

		if(empty($error_msg)){
			if(isset($_POST['email_invoice']) && $_POST['email_invoice'] == 'Y'){
				$invoice = new SI_Invoice();
				if($invoice->get(intval($_POST['invoice_id'])) === FALSE){
					$error_msg .= "Error retreiving invoice!\n";
					debug_message($invoice->getLastError());
				}
				
				if($invoice->sendEmail('InvoiceEmail') === FALSE){
					$error_msg .= "Error sending invoice notification!\n";
					debug_message($invoice->getLastError());
				}
			}
			if(empty($error_msg)){
				goBack();
			}
		}
	}else{
		$error_msg .= "Error adding Payment!\n";
		debug_message($payment->getLastError());
	}
}

?>
Exemplo n.º 2
0
 */
require_once('includes/common.php');
require_once('includes/SI_Invoice.php');
require_once('includes/SI_Company.php');
require_once('includes/SI_PDFInvoice.php');

checkLogin('accounting');

if(intval($_REQUEST['id']) == 0){
  fatal_error("You must provide an invoice id to email!");
}

$invoice = new SI_Invoice();
if($invoice->get(intval($_REQUEST['id'])) === FALSE){
  $error_msg .= "Error retreiving invoice information!\n";
  debug_message($invoice->getLastError());
}

if(!$loggedin_user->hasRight('admin') && !$loggedin_user->hasRight('admin')){
	if($loggedin_user->company_id != $invoice->company_id){
		fatal_error("You do not have rights to access this invoice!");	
	}	
}
$notification = 'InvoiceEmail';
if(isset($_REQUEST['notification'])){
	$notification = $_REQUEST['notification'];
}
if($invoice->sendEmail($notification) === FALSE)
	fatal_error("Error sending invoice:\n".$invoice->getLastError());

goBack(0);