| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/c/o/o/coopiak/amisdesseniors-fr/administrator/components/com_djcatalog2/controllers/ |
Upload File : |
<?php
/**
* @package DJ-Catalog2
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
jimport('joomla.application.component.controllerform');
class Djcatalog2ControllerOrder extends FormController {
public function save($key = null, $urlVar = null) {
return parent::save($key, $urlVar);
}
protected function allowAdd($data = array())
{
$user = Factory::getUser();
return $user->authorise('core.create', $this->option) || $user->authorise('djcatalog2.admin.orders', $this->option);
}
protected function allowEdit($data = array(), $key = 'id')
{
$canDo = Factory::getUser()->authorise('core.edit', $this->option) || Factory::getUser()->authorise('djcatalog2.admin.orders', $this->option);
if (!$canDo) {
$task = Factory::getApplication()->input->getCmd('task');
if ($task == 'edit' && Factory::getUser()->authorise('djcatalog2.access.orders', $this->option)) {
return true;
} else if ($task == 'cancel') {
return true;
}
}
return $canDo;
}
protected function setError($error) {
$app = Factory::getApplication();
$app->enqueueMessage($error,'error');
}
public function change_status() {
// Check for request forgeries.
$this->checkToken();
$model = $this->getModel();
$data = $this->input->post->get('jform', array(), 'array');
$recordId = $this->input->getInt('id');
// Populate the row id from the session.
$data['id'] = $recordId;
// Access check.
if (!$this->allowSave($data, 'id') || !$recordId)
{
$this->setError(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'));
$this->setRedirect(
Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list
. $this->getRedirectToListAppend(), false
)
);
return false;
}
$comment = $this->input->post->getString('history_comment');
$notify = $this->input->post->getInt('history_notify');
$status = $this->input->post->getString('history_status');
if (!$model->set_status($recordId, $status, $notify, $comment))
{
// Redirect back to the edit screen.
$this->setError(\Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(
\Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item
. $this->getRedirectToItemAppend($recordId, 'id'), false
)
);
return false;
}
$this->setRedirect(
\Route::_(
'index.php?option=' . $this->option . '&view=' . $this->view_item
. $this->getRedirectToItemAppend($recordId, 'id'), false
)
);
return true;
}
public function createShipment() {
$app = Factory::getApplication();
$jinput = $app->input;
$model = $this->getModel();
$order_id = $jinput->getInt('id');
$delivery_method_id = $jinput->getInt('delivery_method_id');
$order = $model->getItem($order_id);
$deliveryData = $jinput->get('createShipments', array(), 'array');
$deliveryMethod = $model->getDeliveryMethod($delivery_method_id);
PluginHelper::importPlugin('djcatalog2delivery');
$dispatcher = Joomla\CMS\Factory::getApplication()->getDispatcher();
Joomla\CMS\Factory::getApplication()->triggerEvent('onDJC2ProcessCreateShipments', array('com_djcatalog2.order.delivery', $order, $deliveryData, $deliveryMethod));
}
public function displayDeliveryForm() {
$app = Factory::getApplication();
$jinput = $app->input;
$model = $this->getModel();
$order_id = $jinput->getInt('id');
$delivery_method_id = $jinput->getInt('delivery_method_id');
$order = $model->getItem($order_id);
$deliveryMethod = $model->getDeliveryMethod($delivery_method_id);
PluginHelper::importPlugin('djcatalog2delivery');
$dispatcher = Joomla\CMS\Factory::getApplication()->getDispatcher();
$deliveryForm = Joomla\CMS\Factory::getApplication()->triggerEvent('renderShippmentForm', array('com_djcatalog2.order.delivery', $order, $deliveryMethod));
echo implode("", $deliveryForm);
}
public function downloadDeliveryLabel() {
$app = Factory::getApplication();
$jinput = $app->input;
$model = $this->getModel();
$order_id = $jinput->getInt('oid');
$order = $model->getItem($order_id);
$deliveryMethod = $model->getDeliveryMethod($order->delivery_method_id);
PluginHelper::importPlugin('djcatalog2delivery');
$dispatcher = Joomla\CMS\Factory::getApplication()->getDispatcher();
Joomla\CMS\Factory::getApplication()->triggerEvent('onDJC2DownloadDeliveryLabel', array('com_djcatalog2.order.delivery', $order, $deliveryMethod));
}
}
?>