public function renderNewMessagesList() { try { $this->module->getNewMessages(Context::getContext()->shop->id); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } $this->context->smarty->assign('new_messages_value', count(MediafinanzNewMessage::getMessages())); $this->context->smarty->assign('new_messages', MediafinanzNewMessage::getMessages(false)); $template = $this->createTemplate('new-messages-list' . (_PS_VERSION_ < '1.6.0.0' ? '_15' : '') . '.tpl'); return $template->fetch(); }
public function getNewMessages($id_shop = null) { $soap_client = self::getSoapClient(); $result = $soap_client->getNewMessages($this->getAuth($id_shop)); $transaction_id = $result->transactionId; foreach ($result->messages as $message) { $claim = MediafinanzClaim::getInstanceByFilenumber($message->fileNumber); if (Validate::isLoadedObject($claim)) { $new_message = new MediafinanzNewMessage(); $new_message->id_order = $claim->id_order; $new_message->id_shop = $claim->id_shop; $new_message->file_number = (int) $message->fileNumber; $new_message->invoice_number = (int) $message->invoiceNumber; $new_message->text = $message->text; $new_message->time = date('Y-m-d H:i:s', strtotime($message->time)); $new_message->add(); } } Configuration::updateValue('MEDIAFINANZ_LASTMESSAGEUPDATE', date('Y-m-d H:i:s'), false, null, $id_shop); if ($soap_client->commitTransaction($this->getAuth($id_shop), $transaction_id)) { return true; } }
/** * 2015 Mediafinanz * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to info@easymarketing.de so we can send you a copy immediately. * * @author silbersaiten www.silbersaiten.de <*****@*****.**> * @copyright 2015 Mediafinanz * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once dirname(__FILE__) . '/../../config/config.inc.php'; require_once dirname(__FILE__) . '/../../init.php'; require_once _PS_MODULE_DIR_ . 'mediafinanz/classes/MediafinanzNewMessage.php'; if (Employee::checkPassword(Tools::getValue('iem'), Tools::getValue('iemp'))) { $context = Context::getContext(); $context->employee = new Employee(Tools::getValue('iem')); $context->cookie->passwd = Tools::getValue('iemp'); if (Tools::isSubmit('updateNewMessages')) { die(MediafinanzNewMessage::updateNewMessages()); } } else { die(Tools::displayError('Please log in first')); }