<?php

/*------------------------------------------------------------------------
# com_invoices - Invoice Manager for Joomla
# ------------------------------------------------------------------------
# author				Germinal Camps
# copyright 			Copyright (C) 2012 - 2016 JoomlaThat.com. All Rights Reserved.
# @license				http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: 			http://www.joomlathat.com
# Technical Support:	Forum - http://www.joomlathat.com/support
-------------------------------------------------------------------------*/

//no direct access
defined('_JEXEC') or die('Restricted access.');

jimport('joomla.application.component.controller');

class InvoicesController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function create_recurring(){
		$app = JFactory::getApplication();

		$model = $this->getModel('invoice');
		$howmany = $model->create_recurring();

		$msg = JText::sprintf( 'RECURRING_CREATED', $howmany );

		if($this->input->getInt('ajax')) {
			//we fill the notification to return
			$return = new stdClass();
			$return->notifications = array();
			$return->notifications[0] = new stdClass();
			$return->notifications[0]->message = $msg;
			$return->notifications[0]->type = "message";

			//we fill the content to return
			if($howmany) $return->content = "1" ;
			else $return->content = "" ;

			//we return
			echo json_encode($return);

			$app->close();
		}

		$this->setRedirect( 'index.php?option=com_invoices', $msg );
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}

}

class ItemsController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}

class TemplatesController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}

class TaxesController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}

class ContactsController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}

class TemplateitemsController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}

class PaymentsController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}

class QuotesController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}

class CurrenciesController extends JControllerLegacy{

	function display( $cachable = false, $urlparams = array())
	{
		parent::display($cachable,$urlparams);
	}

	function sendJSONResponse($object, $status = 200){

		InvoicesHelper::sendJSONResponse($object, $status);

	}
}
