Order_tickets - Version 1.3.0

Version Notes

Possibility of disabling answer for closed tickets

Download this release

Release Info

Developer Magento Core Team
Extension Order_tickets
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.4 to 1.3.0

app/code/community/Laurent/OrderTickets/Model/Chat.php CHANGED
@@ -9,7 +9,11 @@
9
  */
10
 
11
  /**
12
- * Description of Chat
 
 
 
 
13
  *
14
  */
15
  class Laurent_OrderTickets_Model_Chat extends Laurent_OrderTickets_Model_Abstract {
@@ -19,6 +23,13 @@ class Laurent_OrderTickets_Model_Chat extends Laurent_OrderTickets_Model_Abstrac
19
 
20
  protected $_order;
21
  protected $_tickets;
 
 
 
 
 
 
 
22
 
23
  /**
24
  * Initialize resource model
@@ -46,9 +57,10 @@ class Laurent_OrderTickets_Model_Chat extends Laurent_OrderTickets_Model_Abstrac
46
  */
47
  public function getTickets(){
48
  if(!$this->_tickets){
49
- $ticketCollection = Mage::getResourceModel('ordertickets/ticket_collection')
50
- ->addFieldToFilter('chat_id', $this->getId())
51
- ->load();
 
52
 
53
  $this->_tickets = $ticketCollection;
54
  }
@@ -63,7 +75,9 @@ class Laurent_OrderTickets_Model_Chat extends Laurent_OrderTickets_Model_Abstrac
63
  * @return string
64
  */
65
  public function getStatusLabel(){
66
- $allStatuses = Mage::helper('ordertickets')->getChatStatuses();
 
 
67
 
68
  if(array_key_exists($this->getStatus(), $allStatuses)){
69
  return $allStatuses[$this->getStatus()];
@@ -76,10 +90,19 @@ class Laurent_OrderTickets_Model_Chat extends Laurent_OrderTickets_Model_Abstrac
76
  /**
77
  * Try to load a chat by a given order id
78
  * @param int $orderId
79
- * @return LaurentOrderTickets_Model_Chat
80
  */
81
  public function loadByOrderId($orderId) {
82
  $orderId = (int) $orderId;
83
  return $this->load($orderId, 'order_id');
84
  }
 
 
 
 
 
 
 
 
 
85
  }
9
  */
10
 
11
  /**
12
+ * @method string getCustomerFirstname()
13
+ * @method string getCustomerLastname()
14
+ * @method string getStatus()
15
+ * @method Laurent_OrderTickets_Model_Chat setStatus(string $status)
16
+ * @method int getOrderId()
17
  *
18
  */
19
  class Laurent_OrderTickets_Model_Chat extends Laurent_OrderTickets_Model_Abstract {
23
 
24
  protected $_order;
25
  protected $_tickets;
26
+
27
+ /**
28
+ * Prefix of model events names
29
+ *
30
+ * @var string
31
+ */
32
+ protected $_eventPrefix = 'ortickets_chat';
33
 
34
  /**
35
  * Initialize resource model
57
  */
58
  public function getTickets(){
59
  if(!$this->_tickets){
60
+ /** @var $ticketCollection Laurent_OrderTickets_Model_Mysql4_Ticket_Collection */
61
+ $ticketCollection = Mage::getResourceModel('ordertickets/ticket_collection');
62
+ $ticketCollection->addFieldToFilter('chat_id', $this->getId());
63
+ $ticketCollection->load();
64
 
65
  $this->_tickets = $ticketCollection;
66
  }
75
  * @return string
76
  */
77
  public function getStatusLabel(){
78
+ /** @var $orderTicketsHelper Laurent_OrderTickets_Helper_Data */
79
+ $orderTicketsHelper = Mage::helper('ordertickets');
80
+ $allStatuses = $orderTicketsHelper->getChatStatuses();
81
 
82
  if(array_key_exists($this->getStatus(), $allStatuses)){
83
  return $allStatuses[$this->getStatus()];
90
  /**
91
  * Try to load a chat by a given order id
92
  * @param int $orderId
93
+ * @return Laurent_OrderTickets_Model_Chat
94
  */
95
  public function loadByOrderId($orderId) {
96
  $orderId = (int) $orderId;
97
  return $this->load($orderId, 'order_id');
98
  }
99
+
100
+ /**
101
+ * Somebody (user of admin) can reply to this chat
102
+ * @return bool
103
+ */
104
+ public function canReply(){
105
+ return (Mage::getStoreConfig('sales/ordertickets/allow_reply_to_closed_ticket')
106
+ || $this->getStatus() != self::STATUS_CLOSED);
107
+ }
108
  }
app/code/community/Laurent/OrderTickets/Model/Ticket.php CHANGED
@@ -9,15 +9,23 @@
9
  */
10
 
11
  /**
12
- * Description of Ticket
 
 
 
13
  *
14
  */
15
  class Laurent_OrderTickets_Model_Ticket extends Laurent_OrderTickets_Model_Abstract {
16
  CONST TYPE_REQUEST = 'request';
17
  CONST TYPE_ANSWER = 'answer';
18
-
19
- protected $_chat;
20
-
 
 
 
 
 
21
  /**
22
  * Initialize resource model
23
  */
@@ -31,7 +39,9 @@ class Laurent_OrderTickets_Model_Ticket extends Laurent_OrderTickets_Model_Abstr
31
  * @return string
32
  */
33
  public function getCreatedAtFormated(){
34
- return Mage::helper('core')->formatDate($this->getCreatedAt(), 'medium', true);
 
 
35
  }
36
 
37
  /**
@@ -47,11 +57,30 @@ class Laurent_OrderTickets_Model_Ticket extends Laurent_OrderTickets_Model_Abstr
47
  * @return Laurent_OrderTickets_Model_Chat
48
  */
49
  public function getChat(){
50
- if(!$this->_chat){
51
- $this->_chat = Mage::getModel('ordertickets/chat')->load($this->getChatId());
52
  }
53
 
54
- return $this->_chat;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
 
57
  }
9
  */
10
 
11
  /**
12
+ * @method string getType()
13
+ * @method string getCreatedAt()
14
+ * @method string getMessage()
15
+ * @method int getChatId()
16
  *
17
  */
18
  class Laurent_OrderTickets_Model_Ticket extends Laurent_OrderTickets_Model_Abstract {
19
  CONST TYPE_REQUEST = 'request';
20
  CONST TYPE_ANSWER = 'answer';
21
+
22
+ /**
23
+ * Prefix of model events names
24
+ *
25
+ * @var string
26
+ */
27
+ protected $_eventPrefix = 'ortickets_ticket';
28
+
29
  /**
30
  * Initialize resource model
31
  */
39
  * @return string
40
  */
41
  public function getCreatedAtFormated(){
42
+ /** @var $coreHelper Mage_Core_Helper_Data */
43
+ $coreHelper = Mage::helper('core');
44
+ return $coreHelper->formatDate($this->getCreatedAt(), 'medium', true);
45
  }
46
 
47
  /**
57
  * @return Laurent_OrderTickets_Model_Chat
58
  */
59
  public function getChat(){
60
+ if(!$this->hasData('chat')){
61
+ $this->setData('chat', Mage::getModel('ordertickets/chat')->load($this->getChatId()));
62
  }
63
 
64
+ return $this->getData('chat');
65
+ }
66
+
67
+ /**
68
+ * Reopen chat if a new request was sent
69
+ * @return Laurent_OrderTickets_Model_Ticket
70
+ */
71
+ public function _afterSave(){
72
+ parent::_afterSave();
73
+ $chat = $this->getChat();
74
+ //Putting back open status if a new request was made
75
+ if(
76
+ $this->getType() == self::TYPE_REQUEST
77
+ && $chat->getStatus() == Laurent_OrderTickets_Model_Chat::STATUS_CLOSED
78
+ )
79
+ {
80
+ $chat->setStatus(Laurent_OrderTickets_Model_Chat::STATUS_OPEN);
81
+ $chat->save();
82
+ }
83
+ return $this;
84
  }
85
 
86
  }
app/code/community/Laurent/OrderTickets/controllers/Adminhtml/ChatController.php CHANGED
@@ -54,7 +54,7 @@ class Laurent_OrderTickets_Adminhtml_ChatController extends Laurent_OrderTickets
54
  try {
55
  $chatModel->save();
56
 
57
- Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Chat was succesfully saved'));
58
  $this->getResponse()->setRedirect($this->getUrl("*/*/"));
59
  return true;
60
  } catch (Exception $e) {
@@ -128,7 +128,7 @@ class Laurent_OrderTickets_Adminhtml_ChatController extends Laurent_OrderTickets
128
  }
129
  }
130
 
131
- $successMsg = $this->__('Chat has been succesfully deleted');
132
  $session->addSuccess($successMsg);
133
  $this->_redirect('*/*/index');
134
  return true;
@@ -165,7 +165,7 @@ class Laurent_OrderTickets_Adminhtml_ChatController extends Laurent_OrderTickets
165
  }
166
  }
167
 
168
- $successMsg = $this->__('Ticket has been succesfully deleted');
169
  $session->addSuccess($successMsg);
170
  $this->_redirectReferer();
171
  return true;
54
  try {
55
  $chatModel->save();
56
 
57
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->__('Chat was successfully saved'));
58
  $this->getResponse()->setRedirect($this->getUrl("*/*/"));
59
  return true;
60
  } catch (Exception $e) {
128
  }
129
  }
130
 
131
+ $successMsg = $this->__('Chat has been successfully deleted');
132
  $session->addSuccess($successMsg);
133
  $this->_redirect('*/*/index');
134
  return true;
165
  }
166
  }
167
 
168
+ $successMsg = $this->__('Ticket has been successfully deleted');
169
  $session->addSuccess($successMsg);
170
  $this->_redirectReferer();
171
  return true;
app/code/community/Laurent/OrderTickets/controllers/ChatController.php CHANGED
@@ -54,9 +54,11 @@ class Laurent_OrderTickets_ChatController extends Mage_Core_Controller_Front_Act
54
  $orderId = $this->getRequest()->getPost('order-id');
55
  $message = $this->getRequest()->getPost('message');
56
  $errorMessage = $this->__('Error while saving your message. Please try again');
 
 
57
 
58
  if (!$orderId) {
59
- Mage::getSingleton('customer/session')->addError($errorMessage);
60
  $this->_redirect('sales/order/history');
61
  return false;
62
  }
@@ -64,7 +66,7 @@ class Laurent_OrderTickets_ChatController extends Mage_Core_Controller_Front_Act
64
  $chat = $this->_loadChat($orderId);
65
 
66
  if (!$chat || !$chat->getId()) {
67
- Mage::getSingleton('customer/session')->addError($errorMessage);
68
  $this->_redirect('*/*/view', array('order_id' => $orderId));
69
  return false;
70
  }
@@ -72,6 +74,7 @@ class Laurent_OrderTickets_ChatController extends Mage_Core_Controller_Front_Act
72
  $chatId = $chat->getId();
73
 
74
  try {
 
75
  $ticket = Mage::getModel('ordertickets/ticket');
76
  $ticket->setChatId($chatId);
77
  $ticket->setMessage($message);
@@ -79,17 +82,23 @@ class Laurent_OrderTickets_ChatController extends Mage_Core_Controller_Front_Act
79
  $ticket->save();
80
  } catch (Exception $e) {
81
  Mage::log('Error while saving a ticket: ' . $e->getMessage(), Zend_Log::ERR);
82
- Mage::getSingleton('customer/session')->addError($errorMessage);
83
  $this->_redirect('*/*/view', array('order_id' => $orderId));
84
  return false;
85
  }
86
 
87
  $successMessage = $this->__('Your message was successfully recorded');
88
- Mage::getSingleton('customer/session')->addSuccess($successMessage);
89
 
90
  $this->_redirect('*/*/view', array('order_id' => $orderId));
91
  }
92
-
 
 
 
 
 
 
93
  protected function _loadChat($orderId){
94
  $chat = Mage::helper('ordertickets')->loadChatFromOrderId($orderId);
95
 
@@ -97,6 +106,7 @@ class Laurent_OrderTickets_ChatController extends Mage_Core_Controller_Front_Act
97
  $order = Mage::getModel('sales/order')->load($orderId);
98
 
99
  try{
 
100
  $chat = Mage::getModel('ordertickets/chat');
101
  $chat->setOrderId($orderId);
102
  $chat->setStatus(Laurent_OrderTickets_Model_Chat::STATUS_OPEN);
54
  $orderId = $this->getRequest()->getPost('order-id');
55
  $message = $this->getRequest()->getPost('message');
56
  $errorMessage = $this->__('Error while saving your message. Please try again');
57
+ /** @var $session Mage_Customer_Model_Session */
58
+ $session = Mage::getSingleton('customer/session');
59
 
60
  if (!$orderId) {
61
+ $session->addError($errorMessage);
62
  $this->_redirect('sales/order/history');
63
  return false;
64
  }
66
  $chat = $this->_loadChat($orderId);
67
 
68
  if (!$chat || !$chat->getId()) {
69
+ $session->addError($errorMessage);
70
  $this->_redirect('*/*/view', array('order_id' => $orderId));
71
  return false;
72
  }
74
  $chatId = $chat->getId();
75
 
76
  try {
77
+ /** @var $ticket Lauren_OrderTickets_Model_Ticket */
78
  $ticket = Mage::getModel('ordertickets/ticket');
79
  $ticket->setChatId($chatId);
80
  $ticket->setMessage($message);
82
  $ticket->save();
83
  } catch (Exception $e) {
84
  Mage::log('Error while saving a ticket: ' . $e->getMessage(), Zend_Log::ERR);
85
+ $session->addError($errorMessage);
86
  $this->_redirect('*/*/view', array('order_id' => $orderId));
87
  return false;
88
  }
89
 
90
  $successMessage = $this->__('Your message was successfully recorded');
91
+ $session->addSuccess($successMessage);
92
 
93
  $this->_redirect('*/*/view', array('order_id' => $orderId));
94
  }
95
+
96
+ /**
97
+ * Load chat or create a new one if needed
98
+ * return the chat or false if an error occured
99
+ * @param $orderId
100
+ * @return bool|Laurent_OrderTickets_Model_Chat
101
+ */
102
  protected function _loadChat($orderId){
103
  $chat = Mage::helper('ordertickets')->loadChatFromOrderId($orderId);
104
 
106
  $order = Mage::getModel('sales/order')->load($orderId);
107
 
108
  try{
109
+ /** @var $chat Laurent_OrderTickets_Model_Chat */
110
  $chat = Mage::getModel('ordertickets/chat');
111
  $chat->setOrderId($orderId);
112
  $chat->setStatus(Laurent_OrderTickets_Model_Chat::STATUS_OPEN);
app/code/community/Laurent/OrderTickets/etc/config.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <modules>
11
  <Laurent_OrderTickets>
12
- <version>1.2.4</version>
13
  </Laurent_OrderTickets>
14
  </modules>
15
  <global>
@@ -133,6 +133,7 @@
133
  <default>
134
  <sales>
135
  <ordertickets>
 
136
  <cron_expr>42 2,14 * * *</cron_expr>
137
  <cron_recipients>name@domain.com</cron_recipients>
138
  </ordertickets>
9
  <config>
10
  <modules>
11
  <Laurent_OrderTickets>
12
+ <version>1.3.0</version>
13
  </Laurent_OrderTickets>
14
  </modules>
15
  <global>
133
  <default>
134
  <sales>
135
  <ordertickets>
136
+ <allow_reply_to_closed_ticket>1</allow_reply_to_closed_ticket>
137
  <cron_expr>42 2,14 * * *</cron_expr>
138
  <cron_recipients>name@domain.com</cron_recipients>
139
  </ordertickets>
app/code/community/Laurent/OrderTickets/etc/system.xml CHANGED
@@ -8,12 +8,21 @@
8
  <frontend_type>text</frontend_type>
9
  <sort_order>70</sort_order>
10
  <show_in_default>1</show_in_default>
11
- <show_in_website>0</show_in_website>
12
  <show_in_store>0</show_in_store>
13
  <fields>
 
 
 
 
 
 
 
 
 
14
  <cron_expr translate="label">
15
  <label>Cron frequency</label>
16
- <sort_order>5</sort_order>
17
  <frontend_type>text</frontend_type>
18
  <backend_model>ordertickets/config_cron</backend_model>
19
  <show_in_default>1</show_in_default>
@@ -23,7 +32,7 @@
23
  <cron_recipients translate="label comment">
24
  <label>Cron recipients</label>
25
  <comment>Separate recipients with comma</comment>
26
- <sort_order>10</sort_order>
27
  <frontend_type>text</frontend_type>
28
  <show_in_default>1</show_in_default>
29
  <show_in_website>0</show_in_website>
8
  <frontend_type>text</frontend_type>
9
  <sort_order>70</sort_order>
10
  <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
  <show_in_store>0</show_in_store>
13
  <fields>
14
+ <allow_reply_to_closed_ticket translate="label">
15
+ <label>Allow reply to closed ticket</label>
16
+ <sort_order>5</sort_order>
17
+ <frontend_type>select</frontend_type>
18
+ <source_model>adminhtml/system_config_source_yesno</source_model>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </allow_reply_to_closed_ticket>
23
  <cron_expr translate="label">
24
  <label>Cron frequency</label>
25
+ <sort_order>10</sort_order>
26
  <frontend_type>text</frontend_type>
27
  <backend_model>ordertickets/config_cron</backend_model>
28
  <show_in_default>1</show_in_default>
32
  <cron_recipients translate="label comment">
33
  <label>Cron recipients</label>
34
  <comment>Separate recipients with comma</comment>
35
+ <sort_order>15</sort_order>
36
  <frontend_type>text</frontend_type>
37
  <show_in_default>1</show_in_default>
38
  <show_in_website>0</show_in_website>
app/design/adminhtml/default/default/template/ordertickets/chat/view/tab/tickets.phtml CHANGED
@@ -5,11 +5,20 @@
5
  * @copyright Copyright (c) 2011 Laurent Clouet
6
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
7
  * @author Laurent Clouet <laurent35240@gmail.com>
8
- *
9
- * @var $this Laurent_OrderTickets_Block_Adminhtml_Chat_View_Tab_Tickets
10
  */
11
  ?>
 
 
 
 
 
 
 
 
 
12
  <?php foreach ($this->getTickets() as $ticket): ?>
 
13
  <div class="entry-edit">
14
  <div class="entry-edit-head">
15
  <h4>
@@ -19,7 +28,7 @@
19
  <?php echo $this->__('Answer') ?>
20
  <?php endif; ?>
21
  </h4>
22
- <?php if(Mage::getSingleton('admin/session')->isAllowed('sales/ordertickets/delete')): ?>
23
  <div class="tools">
24
  <a href="<?php echo $this->getUrl('*/*/deleteTicket', array('ticket_id' => $ticket->getId())) ?>"
25
  onclick="return confirm('<?php echo $this->__('Are you sure you want to delete this ticket?') ?>');">
@@ -29,7 +38,7 @@
29
  <?php endif; ?>
30
  </div>
31
  <div class="fieldset fieldset-wide">
32
- <table cellspacing="0" class="form-list">
33
  <tbody>
34
  <tr>
35
  <td class="label">
@@ -38,7 +47,7 @@
38
  </label>
39
  </td>
40
  <td class="value">
41
- <?php echo Mage::helper('core')->formatDate($ticket->getCreatedAt(), 'full', true) ?>
42
  </td>
43
  </tr>
44
  <tr>
@@ -56,12 +65,13 @@
56
  </div>
57
  </div>
58
  <?php endforeach; ?>
 
59
  <div class="entry-edit">
60
  <div class="entry-edit-head">
61
  <h4><?php echo $this->__('Add an answer'); ?></h4>
62
  </div>
63
  <div class="fieldset fieldset-wide">
64
- <table cellspacing="0" class="form-list">
65
  <tr>
66
  <td class="label"><label for="message"><?php echo $this->__('Message') ?></label></td>
67
  <td class="value"><textarea name="answer[message]" id="message"></textarea></td>
@@ -70,7 +80,7 @@
70
  <td class="label"><label for="status"><?php echo $this->__('Status') ?></label></td>
71
  <td class="value">
72
  <select name="answer[status]" id="status">
73
- <?php foreach (Mage::helper('ordertickets')->getChatStatuses() as $statusKey => $statusLabel): ?>
74
  <option value="<?php echo $statusKey ?>" <?php if ($statusKey == $this->getChat()->getStatus()): ?>selected="selected"<?php endif; ?>>
75
  <?php echo $statusLabel ?>
76
  </option>
@@ -88,6 +98,7 @@
88
  </table>
89
  </div>
90
  </div>
 
91
 
92
  <script type="text/javascript">
93
  function postAnswer()
5
  * @copyright Copyright (c) 2011 Laurent Clouet
6
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
7
  * @author Laurent Clouet <laurent35240@gmail.com>
8
+ *
 
9
  */
10
  ?>
11
+ <?php
12
+ /** @var $this Laurent_OrderTickets_Block_Adminhtml_Chat_View_Tab_Tickets */
13
+ /** @var $session Mage_Admin_Model_Session */
14
+ $session = Mage::getSingleton('admin/session');
15
+ /** @var $coreHelper Mage_Core_Helper_Data */
16
+ $coreHelper = Mage::helper('core');
17
+ /** @var $orderTicketsHelper Laurent_OrderTickets_Helper_Data */
18
+ $orderTicketsHelper = Mage::helper('ordertickets');
19
+ ?>
20
  <?php foreach ($this->getTickets() as $ticket): ?>
21
+ <?php /** @var $ticket Laurent_OrderTickets_Model_Ticket */?>
22
  <div class="entry-edit">
23
  <div class="entry-edit-head">
24
  <h4>
28
  <?php echo $this->__('Answer') ?>
29
  <?php endif; ?>
30
  </h4>
31
+ <?php if($session->isAllowed('sales/ordertickets/delete')): ?>
32
  <div class="tools">
33
  <a href="<?php echo $this->getUrl('*/*/deleteTicket', array('ticket_id' => $ticket->getId())) ?>"
34
  onclick="return confirm('<?php echo $this->__('Are you sure you want to delete this ticket?') ?>');">
38
  <?php endif; ?>
39
  </div>
40
  <div class="fieldset fieldset-wide">
41
+ <table class="form-list">
42
  <tbody>
43
  <tr>
44
  <td class="label">
47
  </label>
48
  </td>
49
  <td class="value">
50
+ <?php echo $coreHelper->formatDate($ticket->getCreatedAt(), 'full', true) ?>
51
  </td>
52
  </tr>
53
  <tr>
65
  </div>
66
  </div>
67
  <?php endforeach; ?>
68
+ <?php if($this->getChat()->canReply()): ?>
69
  <div class="entry-edit">
70
  <div class="entry-edit-head">
71
  <h4><?php echo $this->__('Add an answer'); ?></h4>
72
  </div>
73
  <div class="fieldset fieldset-wide">
74
+ <table class="form-list">
75
  <tr>
76
  <td class="label"><label for="message"><?php echo $this->__('Message') ?></label></td>
77
  <td class="value"><textarea name="answer[message]" id="message"></textarea></td>
80
  <td class="label"><label for="status"><?php echo $this->__('Status') ?></label></td>
81
  <td class="value">
82
  <select name="answer[status]" id="status">
83
+ <?php foreach ($orderTicketsHelper->getChatStatuses() as $statusKey => $statusLabel): ?>
84
  <option value="<?php echo $statusKey ?>" <?php if ($statusKey == $this->getChat()->getStatus()): ?>selected="selected"<?php endif; ?>>
85
  <?php echo $statusLabel ?>
86
  </option>
98
  </table>
99
  </div>
100
  </div>
101
+ <?php endif; ?>
102
 
103
  <script type="text/javascript">
104
  function postAnswer()
app/design/frontend/base/default/template/ordertickets/chat.phtml CHANGED
@@ -20,6 +20,7 @@ $_order = $this->getOrder();
20
  <h3><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h3>
21
  </div>
22
  <?php foreach($this->getTickets() as $ticket):?>
 
23
  <div class="ticket <?php echo $ticket->getType()?>">
24
  <h4>
25
  <?php if($ticket->isRequest()) :?>
@@ -35,6 +36,7 @@ $_order = $this->getOrder();
35
  </div>
36
  <?php endforeach; ?>
37
 
 
38
  <form action="<?php echo $this->getSendTicketPostUrl() ?>" method="post" id="form-send-ticket">
39
  <div class="fieldset">
40
  <h4 class="legend"><?php echo $this->__('Add a message') ?></h4>
@@ -42,7 +44,7 @@ $_order = $this->getOrder();
42
  <li class="wide">
43
  <label for="message" class="required"><em>*</em><?php echo $this->__('Message') ?></label>
44
  <div class="input-box">
45
- <textarea name="message" title="<?php echo $this->__('Message') ?>" class="required-entry input-text" cols="60" rows="5"><?php //echo $this->getEscaped($this->getMessage()) ?></textarea>
46
  </div>
47
  </li>
48
  </ul>
@@ -56,4 +58,5 @@ $_order = $this->getOrder();
56
  </form>
57
  <script type="text/javascript">
58
  var dataForm = new VarienForm('form-send-ticket', true);
59
- </script>
 
20
  <h3><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h3>
21
  </div>
22
  <?php foreach($this->getTickets() as $ticket):?>
23
+ <?php /** @var $ticket Laurent_OrderTickets_Model_Ticket */?>
24
  <div class="ticket <?php echo $ticket->getType()?>">
25
  <h4>
26
  <?php if($ticket->isRequest()) :?>
36
  </div>
37
  <?php endforeach; ?>
38
 
39
+ <?php if($this->getChat()->canReply()): ?>
40
  <form action="<?php echo $this->getSendTicketPostUrl() ?>" method="post" id="form-send-ticket">
41
  <div class="fieldset">
42
  <h4 class="legend"><?php echo $this->__('Add a message') ?></h4>
44
  <li class="wide">
45
  <label for="message" class="required"><em>*</em><?php echo $this->__('Message') ?></label>
46
  <div class="input-box">
47
+ <textarea name="message" id="message" title="<?php echo $this->__('Message') ?>" class="required-entry input-text" cols="60" rows="5"><?php //echo $this->getEscaped($this->getMessage()) ?></textarea>
48
  </div>
49
  </li>
50
  </ul>
58
  </form>
59
  <script type="text/javascript">
60
  var dataForm = new VarienForm('form-send-ticket', true);
61
+ </script>
62
+ <?php endif; ?>
app/locale/fr_FR/Laurent_OrderTickets.csv CHANGED
@@ -1,14 +1,15 @@
1
  "* Required Fields","* Champs Obligatoires"
2
  "Add a message","Ajouter un message"
3
  "Add an answer","Ajouter une réponse"
 
4
  "Answer from %s send the","Réponse de %s envoyée le"
5
  "Answer","Réponse"
6
  "Answer successfully added","Votre réponse a bien été ajoutée"
7
  "Are you sure you want to delete this ticket?","Êtes vous sûr(e) de vouloir supprimer ce ticket ?"
8
  "Back to My Orders","Retour à l'historique des commandes"
9
- "Chat has been succesfully deleted","Cette discussion a bien été supprimée"
10
  "Chat Information","Informations sur la discussion"
11
- "Chat was succesfully saved","La discussion a bien été enregistrée"
12
  "Closed","Clôturé"
13
  "Create","Création"
14
  "Create new order tickets","Créer un ticket pour une commande"
@@ -56,7 +57,7 @@
56
  "This chat does not exist","Cette discussion n'existe pas"
57
  "Tickets already exist for this order. Please add new here.","Il existe déjà des tickets pour cette commande. Ajoutez les nouveaux ici."
58
  "Tickets for order %s","Tickets de la commande %s"
59
- "Ticket has been succesfully deleted","Le ticket a bien été supprimé"
60
  "Ticket type","Type de ticket"
61
  "Ticket has been correctly saved.","Le ticket a bien été enregistré."
62
  "Your message send the","Votre message envoyé le"
1
  "* Required Fields","* Champs Obligatoires"
2
  "Add a message","Ajouter un message"
3
  "Add an answer","Ajouter une réponse"
4
+ "Allow reply to closed ticket","Autoriser à répondre à un ticket fermé"
5
  "Answer from %s send the","Réponse de %s envoyée le"
6
  "Answer","Réponse"
7
  "Answer successfully added","Votre réponse a bien été ajoutée"
8
  "Are you sure you want to delete this ticket?","Êtes vous sûr(e) de vouloir supprimer ce ticket ?"
9
  "Back to My Orders","Retour à l'historique des commandes"
10
+ "Chat has been successfully deleted","Cette discussion a bien été supprimée"
11
  "Chat Information","Informations sur la discussion"
12
+ "Chat was successfully saved","La discussion a bien été enregistrée"
13
  "Closed","Clôturé"
14
  "Create","Création"
15
  "Create new order tickets","Créer un ticket pour une commande"
57
  "This chat does not exist","Cette discussion n'existe pas"
58
  "Tickets already exist for this order. Please add new here.","Il existe déjà des tickets pour cette commande. Ajoutez les nouveaux ici."
59
  "Tickets for order %s","Tickets de la commande %s"
60
+ "Ticket has been successfully deleted","Le ticket a bien été supprimé"
61
  "Ticket type","Type de ticket"
62
  "Ticket has been correctly saved.","Le ticket a bien été enregistré."
63
  "Your message send the","Votre message envoyé le"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Order_tickets</name>
4
- <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">Academic Free License (AFL 3.0)</license>
7
  <channel>community</channel>
@@ -11,11 +11,11 @@
11
  - customer can add message to orders&#xD;
12
  - administrator can see these messages, reply to them, change status of a chat and create new messages&#xD;
13
  - a cron also exists to send a reminder email to administrator about new messages</description>
14
- <notes>Fixing problem of saving ticket in BO</notes>
15
  <authors><author><name>Laurent Clouet</name><user>auto-converted</user><email>laurent35240@gmail.com</email></author></authors>
16
- <date>2012-06-28</date>
17
- <time>22:08:57</time>
18
- <contents><target name="magecommunity"><dir name="Laurent"><dir name="OrderTickets"><dir name="Block"><dir name="Adminhtml"><dir name="Chat"><dir name="Create"><dir name="Order"><file name="Grid.php" hash="c7f1c769d398155bd346edb8fe76d6bf"/></dir><dir name="Steptwo"><file name="Form.php" hash="00359248809a4f067f8c488fda650712"/></dir><file name="Form.php" hash="521cca1147cbcecdf66d6e25e42e93d4"/><file name="Order.php" hash="4b5cbda78abda88f5858b1b389ef5b75"/><file name="Steptwo.php" hash="3a439f520e3469d0499ddf4443df674f"/></dir><dir name="View"><dir name="Tab"><file name="Main.php" hash="03c4041d1cf51152b81960301c1a7a09"/><file name="Tickets.php" hash="1113741720801f3101ba7eea34be9e0f"/></dir><file name="Form.php" hash="39fdb499109549c3f343c558016bbeba"/><file name="Tabs.php" hash="f8013ba3783ab56b81ddf85a9322f6eb"/></dir><file name="Create.php" hash="12830fc66389cc498f31a08e75dcac6f"/><file name="Grid.php" hash="991c017b9bc30ea7d21abc37d5357d1f"/><file name="View.php" hash="878e4932d98a2c46c7a63ac01c3f9e28"/></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Tickets.php" hash="ed5185f29d37f483f7db8538773fe6a7"/></dir></dir></dir><dir name="Order"><dir name="View"><dir name="Tab"><file name="Tickets.php" hash="21259dd5bcaed5c30062b09ba4597561"/></dir></dir></dir><file name="Chat.php" hash="1c2c452367328e34b5e887473e06a220"/></dir><dir name="Order"><file name="Tabs.php" hash="33f15dfed00eca206271cef1f6d17f88"/></dir><file name="Chat.php" hash="4b0247f7c114a894adba736e08cdda7c"/></dir><dir name="Controller"><dir name="Adminhtml"><file name="Chat.php" hash="43b419b5c2b5e6900051e6358153175d"/></dir></dir><dir name="Helper"><file name="Data.php" hash="93cacb500a03173347d3136403be13b1"/></dir><dir name="Model"><dir name="Config"><file name="Cron.php" hash="71180552ddcaa52e340668255ed871a0"/></dir><dir name="Mysql4"><dir name="Chat"><file name="Collection.php" hash="3765532820c8272190ad6bd65a42594d"/></dir><dir name="Ticket"><file name="Collection.php" hash="c04b0fe47e291380a57dce1939425b95"/></dir><file name="Chat.php" hash="105edfaafa9109c87dfb509b641decdc"/><file name="Ticket.php" hash="f9f4e7f6e9da8c110d5042760fe1183e"/></dir><file name="Abstract.php" hash="1c3cebb3cdfbba03c4b21198e2412bd5"/><file name="Chat.php" hash="64ee63f9f7d636c24ba9bde51f7fa5d3"/><file name="Observer.php" hash="b6d6db35f8d63fc8cf6c8f9f96730e80"/><file name="Ticket.php" hash="967e3fd66fd24b689a38f3e1970d5e98"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ChatController.php" hash="074737a0f23108e91b9075bad9cad78b"/><file name="CreateController.php" hash="cbe6071edf569cbfd78036063e0c08f4"/></dir><file name="ChatController.php" hash="d290e0593e45dcb5aec6c44b586f0888"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f4a61001efef301ff263010aad0ecb9d"/><file name="config.xml" hash="2832071d770863096cf7edaa1a5c7ab8"/><file name="system.xml" hash="37739c5007d90bdf7ee8cbe567e98b6a"/></dir><dir name="sql"><dir name="ordertickets_setup"><file name="mysql4-install-0.1.0.php" hash="eaf0ed1190d400612f7eda66b51a28df"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="a59e90142a8ba64c370f59699878a7e1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ordertickets.xml" hash="066b893e6f6d4043f0d7ef0093d7d840"/></dir><dir name="template"><dir name="ordertickets"><dir name="chat"><dir name="create"><file name="abstract.phtml" hash="19cbea5ac678b9197b08c6d9e8f55880"/><file name="form.phtml" hash="5a45de144e3f0b6b52a2e2ee19450413"/></dir><dir name="view"><dir name="tab"><file name="tickets.phtml" hash="c9bdcaca76a70fd3c4a7bbcdf02fa3bf"/></dir></dir></dir><dir name="order"><dir name="view"><dir name="tab"><file name="tickets.phtml" hash="f3aa00997858afcf85373b8e0f1716db"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ordertickets.xml" hash="ff2e6b3a75dcf121fdc5a11bc320d46f"/></dir><dir name="template"><dir name="ordertickets"><dir name="order"><file name="tabs.phtml" hash="3a146acbd5ef5af0a7c939f60ee4c383"/></dir><file name="chat.phtml" hash="d1b6b23797743377040aa3d401ea5001"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Laurent_OrderTickets.xml" hash="46fdc0a685ad8d9144f4db4cb99f97fe"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Laurent_OrderTickets.csv" hash="5cd05adbf7fb074b01ede590ce30a04e"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="ordertickets.css" hash="f009140fffa838b6b3a3bfe011cebaa2"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies/>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Order_tickets</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">Academic Free License (AFL 3.0)</license>
7
  <channel>community</channel>
11
  - customer can add message to orders&#xD;
12
  - administrator can see these messages, reply to them, change status of a chat and create new messages&#xD;
13
  - a cron also exists to send a reminder email to administrator about new messages</description>
14
+ <notes>Possibility of disabling answer for closed tickets</notes>
15
  <authors><author><name>Laurent Clouet</name><user>auto-converted</user><email>laurent35240@gmail.com</email></author></authors>
16
+ <date>2012-10-07</date>
17
+ <time>17:45:57</time>
18
+ <contents><target name="magecommunity"><dir name="Laurent"><dir name="OrderTickets"><dir name="Block"><dir name="Adminhtml"><dir name="Chat"><dir name="Create"><dir name="Order"><file name="Grid.php" hash="c7f1c769d398155bd346edb8fe76d6bf"/></dir><dir name="Steptwo"><file name="Form.php" hash="00359248809a4f067f8c488fda650712"/></dir><file name="Form.php" hash="521cca1147cbcecdf66d6e25e42e93d4"/><file name="Order.php" hash="4b5cbda78abda88f5858b1b389ef5b75"/><file name="Steptwo.php" hash="3a439f520e3469d0499ddf4443df674f"/></dir><dir name="View"><dir name="Tab"><file name="Main.php" hash="03c4041d1cf51152b81960301c1a7a09"/><file name="Tickets.php" hash="1113741720801f3101ba7eea34be9e0f"/></dir><file name="Form.php" hash="39fdb499109549c3f343c558016bbeba"/><file name="Tabs.php" hash="f8013ba3783ab56b81ddf85a9322f6eb"/></dir><file name="Create.php" hash="12830fc66389cc498f31a08e75dcac6f"/><file name="Grid.php" hash="991c017b9bc30ea7d21abc37d5357d1f"/><file name="View.php" hash="878e4932d98a2c46c7a63ac01c3f9e28"/></dir><dir name="Customer"><dir name="Edit"><dir name="Tab"><file name="Tickets.php" hash="ed5185f29d37f483f7db8538773fe6a7"/></dir></dir></dir><dir name="Order"><dir name="View"><dir name="Tab"><file name="Tickets.php" hash="21259dd5bcaed5c30062b09ba4597561"/></dir></dir></dir><file name="Chat.php" hash="1c2c452367328e34b5e887473e06a220"/></dir><dir name="Order"><file name="Tabs.php" hash="33f15dfed00eca206271cef1f6d17f88"/></dir><file name="Chat.php" hash="4b0247f7c114a894adba736e08cdda7c"/></dir><dir name="Controller"><dir name="Adminhtml"><file name="Chat.php" hash="43b419b5c2b5e6900051e6358153175d"/></dir></dir><dir name="Helper"><file name="Data.php" hash="93cacb500a03173347d3136403be13b1"/></dir><dir name="Model"><dir name="Config"><file name="Cron.php" hash="71180552ddcaa52e340668255ed871a0"/></dir><dir name="Mysql4"><dir name="Chat"><file name="Collection.php" hash="3765532820c8272190ad6bd65a42594d"/></dir><dir name="Ticket"><file name="Collection.php" hash="c04b0fe47e291380a57dce1939425b95"/></dir><file name="Chat.php" hash="105edfaafa9109c87dfb509b641decdc"/><file name="Ticket.php" hash="f9f4e7f6e9da8c110d5042760fe1183e"/></dir><file name="Abstract.php" hash="1c3cebb3cdfbba03c4b21198e2412bd5"/><file name="Chat.php" hash="1f8a6bea02208100938ee9f38a1c5d74"/><file name="Observer.php" hash="b6d6db35f8d63fc8cf6c8f9f96730e80"/><file name="Ticket.php" hash="a7d70471a959d82c6c9ff184d50eea9e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ChatController.php" hash="22110c7385e72f371bf36b7f1dfe4eab"/><file name="CreateController.php" hash="cbe6071edf569cbfd78036063e0c08f4"/></dir><file name="ChatController.php" hash="276a4b7488baed2fcbb8a10f6e066c4e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f4a61001efef301ff263010aad0ecb9d"/><file name="config.xml" hash="d0022d453d1cb1fc6344735a47795cc7"/><file name="system.xml" hash="33934d7e9443b340daa1b58b36294dc8"/></dir><dir name="sql"><dir name="ordertickets_setup"><file name="mysql4-install-0.1.0.php" hash="eaf0ed1190d400612f7eda66b51a28df"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="a59e90142a8ba64c370f59699878a7e1"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ordertickets.xml" hash="066b893e6f6d4043f0d7ef0093d7d840"/></dir><dir name="template"><dir name="ordertickets"><dir name="chat"><dir name="create"><file name="abstract.phtml" hash="19cbea5ac678b9197b08c6d9e8f55880"/><file name="form.phtml" hash="5a45de144e3f0b6b52a2e2ee19450413"/></dir><dir name="view"><dir name="tab"><file name="tickets.phtml" hash="baa5371991469d993477bae28cfacf2f"/></dir></dir></dir><dir name="order"><dir name="view"><dir name="tab"><file name="tickets.phtml" hash="f3aa00997858afcf85373b8e0f1716db"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ordertickets.xml" hash="ff2e6b3a75dcf121fdc5a11bc320d46f"/></dir><dir name="template"><dir name="ordertickets"><dir name="order"><file name="tabs.phtml" hash="3a146acbd5ef5af0a7c939f60ee4c383"/></dir><file name="chat.phtml" hash="074eb18924a8c6fb4d4d29a7286486bb"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Laurent_OrderTickets.xml" hash="46fdc0a685ad8d9144f4db4cb99f97fe"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Laurent_OrderTickets.csv" hash="6a8cafdb0a9b7136cfbc7b30fe2edb2b"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="ordertickets.css" hash="f009140fffa838b6b3a3bfe011cebaa2"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
  <dependencies/>
21
  </package>