Textmaster_Textmaster - Version 1.0.8

Version Notes

Added new feature : Negotiated contracts
Improved translations

Download this release

Release Info

Developer Textmaster
Extension Textmaster_Textmaster
Version 1.0.8
Comparing to
See all releases


Code changes from version 1.0.7 to 1.0.8

app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Grid.php CHANGED
@@ -97,6 +97,7 @@
97
  'options'=> array (
98
  Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR),
99
  Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM),
 
100
  ),
101
  'filter_condition_callback' => array($this, '_apiFilter'),
102
  ));
97
  'options'=> array (
98
  Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR),
99
  Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM),
100
+ Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_ENTERPRISE => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_ENTERPRISE),
101
  ),
102
  'filter_condition_callback' => array($this, '_apiFilter'),
103
  ));
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step2.php CHANGED
@@ -11,7 +11,7 @@
11
  * @category Addonline
12
  * @package Textmaster_Textmaster
13
  * @copyright Copyright (c) 2014 Textmaster
14
- * @author Addonline (http://www.addonline.fr)
15
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
  */
17
 
@@ -21,403 +21,412 @@
21
  * @category Addonline
22
  * @package Textmaster_Textmaster
23
  * @copyright Copyright (c) 2014 Textmaster
24
- * @author Addonline (http://www.addonline.fr)
25
  */
26
  class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step2 extends Mage_Adminhtml_Block_Widget_Form {
27
-
28
- private $_exclude_attribute = array(
29
- 'ean',
30
- 'sku',
31
- 'custom_layout_update',
32
- 'recurring_profile',
33
- 'small_image',
34
- 'image',
35
- 'thumbnail',
36
- 'media_gallery',
37
- 'gallery',
38
- 'url_path',
39
- 'custom_design',
40
- 'page_layout',
41
- 'options_container',
42
- 'country_of_manufacture',
43
- 'msrp_enabled',
44
- 'msrp_display_actual_price_type',
45
- );
46
-
47
- protected function _prepareForm() {
48
- $_api = Mage::helper('textmaster')->getApi();
49
- Mage::helper('textmaster')->getApi();
50
- $form = new Varien_Data_Form (array(
51
  'id' => 'edit_form',
52
  'action' => $this->getUrl('*/*/addproject', array('step' => 2)),
53
  'method' => 'post',
54
- 'enctype' => 'multipart/form-data'
55
  ));
56
- $form->setUseContainer(true);
57
- $this->setForm ( $form );
58
- $fieldset = $form->addFieldset ( 'project_type', array (
59
- 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Project' )
60
- ));
61
-
62
-
63
- $ctype = $fieldset->addField ( 'ctype', 'select', array (
64
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Type' ),
65
- 'class' => 'required-entry',
66
- 'required' => true,
67
- 'name' => 'ctype',
68
- 'values' => array (
69
- /*'-1' => Mage::helper ( 'textmaster' )->__ ( 'Select type' ),*/
70
- //Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_COPYWRITING => ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_COPYWRITING ),
71
- Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION => Mage::helper ( 'textmaster' )->__ (ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION )),
72
- Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_PROOFREADING => Mage::helper ( 'textmaster' )->__ (ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_PROOFREADING ))
73
- ),
74
- 'disabled' => false,
75
- 'readonly' => false
76
- ));
77
 
78
- $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
79
- $text = '';
80
- $products = array();
81
- foreach($products_id as $id){
82
- $products[] = Mage::getModel('catalog/product')->load($id);
83
- }
84
-
85
- $fieldset = $form->addFieldset ( 'project_attribute', array (
86
- 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Fields to translate' )
87
- ) );
88
- $aAttributes = Mage::getModel ( 'catalog/product' )->getAttributes ();
89
- $aResult = array();
90
- $aAfterJs = array();
91
- $first = true;
92
- $this->_name_attribute_id = false;
93
- $this->_description_attribute_id = false;
94
- $this->_short_description_attribute_id = false;
95
- foreach(Mage::app()->getStores() as $k => $store){
96
-
97
- $productCollection = Mage::getModel('catalog/product')->getCollection();
98
- $productCollection->addStoreFilter($store->getId());
99
- foreach ($aAttributes as $attr){
100
- if($attr->getAttributecode()=='name') $this->_name_attribute_id = $attr->getAttributeId();
101
- if($attr->getAttributecode()=='description') $this->_description_attribute_id = $attr->getAttributeId();
102
- if($attr->getAttributecode()=='short_description') $this->_short_description_attribute_id = $attr->getAttributeId();
103
-
104
- if(in_array($attr->getAttributecode(),$this->_exclude_attribute)) continue;
105
-
106
- if ($attr->getBackendType () == 'varchar' || $attr->getBackendType () == 'text') {
107
- $productCollection->addAttributeToSelect($attr->getAttributecode());
108
- }
109
- }
110
- $productCollection->getSelect()->where('product_id IN ('.implode(',',$products_id).')');
111
-
112
-
113
-
114
- foreach ( $aAttributes as $attr ) {
115
-
116
- if(in_array($attr->getAttributecode(),$this->_exclude_attribute)) continue;
117
- if ($attr->getBackendType () == 'varchar' || $attr->getBackendType () == 'text') {
118
- $word_count = 0;
119
- foreach($productCollection as $product){
120
- $word_count += Mage::helper ( 'textmaster' )->countWord($product->getData($attr->getAttributecode()));
121
- }
122
- if($first){
123
- $aResult [] = array (
124
- 'value' => $attr->getAttributeId(),
125
- 'label' => Mage::helper('catalog')->__($attr->getFrontendLabel ()) . ' - <span class="tprice">'.$word_count.'</span> '.Mage::helper('textmaster')->__('word(s)')
126
- );
127
- }
128
- $aAfterJs[$store->getId()][$attr->getAttributeId()] = $word_count;
129
- }
130
- }
131
- $first = false;
132
- }
133
- $tarifs = $_api->getPricings();
134
- $currency = Mage::getModel('directory/currency')->load($tarifs['code']);
135
- $curr = Mage::app()->getLocale()->currency($currency->getCode());
136
 
137
- if($this->getProject() && $this->getProject()->hasDocumentsNotCount()) {
138
- $docs = $this->getProject()->getDocuments();
139
- $docsc = $this->getProject()->getDocumentsNotCount();
140
- $ndoc = count($docs);
141
- $ndocc = count($docsc);
142
- $nd = $ndoc-$ndocc;
143
- $nd = $nd / $ndoc;
144
- $r = round($nd,2)*100;
145
- } else {
146
- $r = 100;
147
- }
148
- $attributes = $fieldset->addField ( 'attribute', 'checkboxes', array (
149
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Product informations' ),
150
- 'name' => 'attribute[]',
151
- 'values' => $aResult
152
- ) )->setAfterElementHtml('
153
- <button id="all-attributes">'.Mage::helper ( 'textmaster' )->__ ( 'Select all' ).'</button>
154
- <button id="notall-attributes">'.Mage::helper ( 'textmaster' )->__ ( 'Deselect all' ).'</button>
155
- <script>
156
  var attribute_word_count = '.Mage::helper('core')->jsonEncode($aAfterJs).';
157
- var nouveau_message_loader = "'.Mage::helper ( 'textmaster' )->__ ( 'Nouveau message variable' ).'";
158
- var message_loader_tm = "'.Mage::helper ( 'textmaster' )->__ ( 'message_loader_tm' ).'";
159
- var must_display_loader = '.($this->getProject() && ($this->getProject()->hasDocumentsNotCount() || ($this->getProject()->getTranslationMemory() && ($this->getProject()->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_IN_PROGRESS || $this->getProject()->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_COMPLETED))) ?"true":'false').';
160
- var pourcent_avance = '.$r.';
161
- var textmasterurl_count = "'.($this->getProject()?Mage::getSingleton('adminhtml/url')->getUrl('*/*/createprojectready',array('id'=>$this->getProject()->getId())):'').'";
162
- var currency_symbol = "'.$curr->getSymbol().'";
163
  </script>');
164
-
165
-
166
-
167
- $fieldset = $form->addFieldset ( 'project_languages', array (
168
- 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Languages' )
169
- ) );
170
-
171
- $languages = $_api->getLanguages ();
172
- $used_language = array();
173
- foreach ($languages as $language){
174
- $used_language[] = $language['code'];
175
- }
176
-
177
- $stores = Mage::getModel('core/store')->getCollection();
178
-
179
- $languagesSelect = array ();
180
- $correspondances = array ();
181
- $languagesSelect [''] = Mage::helper ( 'textmaster' )->__ ( 'Select a language' );
182
- foreach($stores as $store) {
183
- // $code = Mage::getStoreConfig('general/locale/code',$store->getId());
184
- // $local = explode('_',$code);
185
- $local = Mage::helper('textmaster')->getFormatedLangCode($store->getId());
186
- if(in_array($local,$used_language))
187
- $languagesSelect [$store->getId()] = $store->getWebsite()->getName().' - '.$store->getName();
188
- $correspondances[$store->getId()] = $local;
189
- }
190
-
191
-
192
-
193
- $fieldset->addField ( 'store_id_origin', 'select', array (
194
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Source language' ),
195
- 'class' => 'required-entry',
196
- 'required' => true,
197
- 'name' => 'store_id_origin',
198
- 'values' => $languagesSelect,
199
- 'disabled' => false,
200
- 'readonly' => false
201
- ) );
202
-
203
- $language_to = $fieldset->addField ( 'store_id_translation', 'select', array (
204
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Target language' ),
205
- 'class' => 'required-entry',
206
- 'required' => true,
207
- 'name' => 'store_id_translation',
208
- 'values' => $languagesSelect,
209
- 'disabled' => false,
210
- 'readonly' => false
211
- ) );
212
-
213
- $this->setChild ( 'form_after', $this->getLayout ()->createBlock ( 'adminhtml/widget_form_element_dependence' )->addFieldMap ( $ctype->getHtmlId (), $ctype->getName () )->addFieldMap ( $language_to->getHtmlId (), $language_to->getName () )->addFieldDependence ( $language_to->getName (), $ctype->getName (), Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION ) );
214
-
215
-
216
-
217
-
218
- $fieldset = $form->addFieldset ( 'project_options', array (
219
- 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Pricing options' )
220
- ));
221
-
222
-
223
 
224
- $fieldset->addField('language_level', 'select', array(
225
- 'label' => Mage::helper('textmaster')->__('Service level'),
226
- 'name' => 'language_level',
227
- 'required' => true,
228
- 'values' => array(
229
- // Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR),
230
- Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM => 'Standard',
231
- Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_ENTERPRISE => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_ENTERPRISE),
232
- ),
233
  // Mage::helper('textmaster')->__('Regular (%s/word): native-speaking translator for word-for-word translations of short texts.',$currency->format($tarifs['types']['translation']['regular'])).'<br/>'.
234
- 'after_element_html' => '<br/><small>'.
235
- Mage::helper('textmaster')->__('Standard (%s/word): experienced translator; suitable for business use.',$currency->format($tarifs['types']['translation']['premium'])) .'<br/>'.
236
- Mage::helper('textmaster')->__('Enterprise (%s/word): professional translator specialized in a specific field; suitable for technical or complex content.',$currency->format($tarifs['types']['translation']['enterprise'])) .'<br/>'.
237
- '</small>',
238
- ));
239
-
240
-
241
- $fieldset->addField ( 'quality', 'select', array (
242
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Quality Control (+%s/word)', $currency->format($tarifs['types']['translation']['quality'],array(),false)),
243
- 'name' => 'quality',
244
- 'required' => true,
245
- 'values' => array(
246
- Mage::helper ( 'textmaster' )->__ ( 'No' ),
247
- Mage::helper ( 'textmaster' )->__ ( 'Yes' )
248
- ),
249
- 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('The translator\'s work will be proofread and corrected by TextMaster').'</small>',
250
- ) );
251
- $fieldset->addField ( 'priority', 'select', array (
252
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Priority Order (+%s/word)', $currency->format($tarifs['types']['translation']['priority'],array(),false) ),
253
- 'name' => 'priority',
254
- 'required' => true,
255
- 'values' => array(
256
- Mage::helper ( 'textmaster' )->__ ( 'No' ),
257
- Mage::helper ( 'textmaster' )->__ ( 'Yes' )
258
- ),
259
- 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('Your project will be assigned a higher priority status.').'</small>',
260
- ) );
261
- // $fieldset->addField ( 'expertise', 'select', array (
262
- // 'label' => Mage::helper ( 'textmaster' )->__ ( 'Expertise (+%s/word)', $currency->format($tarifs['types']['translation']['expertise'],array(),false) ),
263
- // 'name' => 'expertise',
264
- // 'required' => true,
265
- // 'values' => array(
266
- // Mage::helper ( 'textmaster' )->__ ( 'No' ),
267
- // Mage::helper ( 'textmaster' )->__ ( 'Yes' )
268
- // ),
269
- // 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('We provide you with an expert in the selected category.').'</small>',
270
-
271
- // ) );
272
- $fieldset->addField('translation_memory', 'select', array (
273
- 'label' => Mage::helper('textmaster')->__('Translation memory (+%s/word)', $currency->format($tarifs['types']['translation']['translation_memory'], array(), false)),
274
- 'name' => 'translation_memory',
275
- 'disabled' => 'disabled',
276
- 'required' => true,
277
- 'values' => array(
278
- Mage::helper ( 'textmaster' )->__ ( 'No' ),
279
- Mage::helper ( 'textmaster' )->__ ( 'Yes' )
280
- ),
281
- 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('We will find some words in our database').'</small>',
282
-
283
- ) );
284
 
285
-
286
- $fieldset = $form->addFieldset ( 'project_name', array (
287
- 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Instructions du projet' )
288
- ));
289
-
290
- $fieldset->addField ( 'name', 'text', array (
291
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Name' ),
292
- 'class' => 'required-entry',
293
- 'required' => true,
294
- 'name' => 'name'
295
- ));
296
-
297
- $html_briefing = '<script>
 
 
 
 
 
 
 
 
 
298
  var briefing_translation = new Array();
299
  var briefing_proofreading = new Array();'."\n";
300
- foreach ($languages as $langue) {
301
- $html_briefing .= 'briefing_translation[\''.$langue['code'].'\'] = \''.addslashes(Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_translation_'.$langue['code'])).'\';'."\n";
302
- $html_briefing .= 'briefing_proofreading[\''.$langue['code'].'\'] = \''.addslashes(Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_proofreading_'.$langue['code'])).'\';'."\n";
303
- }
304
- $html_briefing .= 'store_langue_correspondance = '.json_encode($correspondances).';'."\n";
305
-
306
- $html_briefing .= '</script>';
307
-
308
- $fieldset->addField ( 'project_briefing', 'textarea', array (
309
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Briefing' ),
310
- 'class' => 'required-entry',
311
- 'required' => true,
312
- 'name' => 'project_briefing'
313
- ))->setAfterElementHtml($html_briefing);
314
-
315
- $categories = $_api->getCategories();
316
- $categoriesSelect = array ();
317
- $categoriesSelect [-1] = Mage::helper ( 'textmaster' )->__ ( 'Select a category' );
318
- foreach ( $categories as $categorie ) {
319
-
320
- $categoriesSelect [$categorie ["code"]] = $categorie ["value"];
321
- }
322
-
323
- $fieldset->addField ( 'category', 'select', array (
324
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Category (optional)' ),
325
- 'name' => 'category',
326
- 'values' => $categoriesSelect,
327
- 'disabled' => false,
328
- 'readonly' => false
329
- ) );
330
-
331
- $fieldset->addField ( 'same_author_must_do_entire_project', 'select', array (
332
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Single Author (Assign the entire project to a single TextMaster)' ),
333
- 'name' => 'same_author_must_do_entire_project',
334
- 'required' => true,
335
- 'values' => array(
336
- Mage::helper ( 'textmaster' )->__ ( 'Non' ),
337
- Mage::helper ( 'textmaster' )->__ ( 'Oui' )
338
- ),
339
- 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('Ensures better continuity, but longer turnaround time').'</small>',
340
-
341
- ) );
342
-
343
- $this->setChild ( 'form_after',
344
- $this->getLayout ()->createBlock('adminhtml/widget_form_element_dependence')
345
- ->addFieldMap($ctype->getHtmlId(),$ctype->getName())
346
- ->addFieldMap($language_to->getHtmlId(), $language_to->getName())
347
- ->addFieldDependence($language_to->getName(), $ctype->getName(), Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION )
348
- );
349
-
350
- $this->setFormValues();
351
-
352
-
353
- return parent::_prepareForm ();
354
- }
355
-
356
- public function setFormValues(){
357
-
358
- if($this->getProject()){
359
- $post = $this->getProject()->getData();
360
- $authors = $this->getProject()->getTextmasters();
361
- if(count($authors)) {
362
- $post['ismytextmaster'] = 1;
363
- }
364
- $post['attribute'] = array();
365
- foreach($this->getProject()->getAttributes() as $attribute){
366
- $post['attribute'][] = $attribute->getTextmasterAttributeId();
367
- }
368
- } else {
369
- $post = Mage::getSingleton('core/session')->getProjectInfo();
370
- if(!$post || count($post)==0){
371
- $post['quality'] = 1;
372
- $post['language_level'] = Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM;
373
- $post['attribute'] = array();
374
- if($this->_name_attribute_id){
375
- $post['attribute'][] = $this->_name_attribute_id;
376
- }
377
- if($this->_description_attribute_id){
378
- $post['attribute'][] = $this->_description_attribute_id;
379
- }
380
- if($this->_short_description_attribute_id){
381
- $post['attribute'][] = $this->_short_description_attribute_id;
382
- }
383
- $post['ctype'] = Mage::getStoreConfig('textmaster/defaultvalue/default_type');
384
-
385
-
386
- $used_language = Mage::getStoreConfig('textmaster/defaultvalue/default_language');
387
- $stores = Mage::getModel('core/store')->getCollection();
388
- $current_locale = '';
389
- foreach ( $stores as $store ) {
390
- $code = Mage::getStoreConfig('general/locale/code',$store->getId());
391
- $local = explode('_',$code);
392
- if($local[0]==$used_language) {
393
- $post['store_id_origin'] = $store->getId();
394
- $current_locale = $local[0];
395
- }
396
- }
397
- if($post['ctype']!='translation' && $post['ctype']!='proofreading')
398
- $post['ctype']='translation';
399
- $post['project_briefing'] = Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_'.$post['ctype'].'_'.$current_locale);
400
- $post['same_author_must_do_entire_project'] = Mage::getStoreConfig('textmaster/defaultvalue/single_author');
401
- $post['expertise'] = Mage::getStoreConfig('textmaster/defaultvalue/expertise');
402
- //Commerce (C019) par default
403
- $post['category'] = Mage::getStoreConfig('textmaster/defaultvalue/category')?Mage::getStoreConfig('textmaster/defaultvalue/category'):'C019';
404
-
405
- }
406
- }
407
-
408
- //$post['word_count'] = $word_count;
409
- if ($post) {
410
- $this->getForm()->setValues ( $post );
411
- }
412
- }
413
-
414
- public function setProject($project){
415
- $this->_project = $project;
416
- return $this;
417
- }
418
-
419
- public function getProject(){
420
- return $this->_project;
421
- }
422
-
423
  }
11
  * @category Addonline
12
  * @package Textmaster_Textmaster
13
  * @copyright Copyright (c) 2014 Textmaster
14
+ * @author Addonline (http://www.addonline.fr)
15
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
  */
17
 
21
  * @category Addonline
22
  * @package Textmaster_Textmaster
23
  * @copyright Copyright (c) 2014 Textmaster
24
+ * @author Addonline (http://www.addonline.fr)
25
  */
26
  class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step2 extends Mage_Adminhtml_Block_Widget_Form {
27
+
28
+ private $_exclude_attribute = array(
29
+ 'ean',
30
+ 'sku',
31
+ 'custom_layout_update',
32
+ 'recurring_profile',
33
+ 'small_image',
34
+ 'image',
35
+ 'thumbnail',
36
+ 'media_gallery',
37
+ 'gallery',
38
+ 'url_path',
39
+ 'custom_design',
40
+ 'page_layout',
41
+ 'options_container',
42
+ 'country_of_manufacture',
43
+ 'msrp_enabled',
44
+ 'msrp_display_actual_price_type',
45
+ );
46
+
47
+ protected function _prepareForm() {
48
+ $_api = Mage::helper('textmaster')->getApi();
49
+ Mage::helper('textmaster')->getApi();
50
+ $form = new Varien_Data_Form (array(
51
  'id' => 'edit_form',
52
  'action' => $this->getUrl('*/*/addproject', array('step' => 2)),
53
  'method' => 'post',
54
+ 'enctype' => 'multipart/form-data'
55
  ));
56
+ $form->setUseContainer(true);
57
+ $this->setForm ( $form );
58
+ $fieldset = $form->addFieldset ( 'project_type', array (
59
+ 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Project' )
60
+ ));
61
+
62
+
63
+ $ctype = $fieldset->addField ( 'ctype', 'select', array (
64
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Type' ),
65
+ 'class' => 'required-entry',
66
+ 'required' => true,
67
+ 'name' => 'ctype',
68
+ 'values' => array (
69
+ /*'-1' => Mage::helper ( 'textmaster' )->__ ( 'Select type' ),*/
70
+ //Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_COPYWRITING => ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_COPYWRITING ),
71
+ Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION => Mage::helper ( 'textmaster' )->__ (ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION )),
72
+ Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_PROOFREADING => Mage::helper ( 'textmaster' )->__ (ucfirst ( Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_PROOFREADING ))
73
+ ),
74
+ 'disabled' => false,
75
+ 'readonly' => false
76
+ ));
77
 
78
+ $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
79
+ $text = '';
80
+ $products = array();
81
+ foreach($products_id as $id){
82
+ $products[] = Mage::getModel('catalog/product')->load($id);
83
+ }
84
+
85
+ $fieldset = $form->addFieldset ( 'project_attribute', array (
86
+ 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Fields to translate' )
87
+ ) );
88
+ $aAttributes = Mage::getModel ( 'catalog/product' )->getAttributes ();
89
+ $aResult = array();
90
+ $aAfterJs = array();
91
+ $first = true;
92
+ $this->_name_attribute_id = false;
93
+ $this->_description_attribute_id = false;
94
+ $this->_short_description_attribute_id = false;
95
+ foreach(Mage::app()->getStores() as $k => $store){
96
+
97
+ $productCollection = Mage::getModel('catalog/product')->getCollection();
98
+ $productCollection->addStoreFilter($store->getId());
99
+ foreach ($aAttributes as $attr){
100
+ if($attr->getAttributecode()=='name') $this->_name_attribute_id = $attr->getAttributeId();
101
+ if($attr->getAttributecode()=='description') $this->_description_attribute_id = $attr->getAttributeId();
102
+ if($attr->getAttributecode()=='short_description') $this->_short_description_attribute_id = $attr->getAttributeId();
103
+
104
+ if(in_array($attr->getAttributecode(),$this->_exclude_attribute)) continue;
105
+
106
+ if ($attr->getBackendType () == 'varchar' || $attr->getBackendType () == 'text') {
107
+ $productCollection->addAttributeToSelect($attr->getAttributecode());
108
+ }
109
+ }
110
+ $productCollection->getSelect()->where('product_id IN ('.implode(',',$products_id).')');
111
+
112
+
113
+
114
+ foreach ( $aAttributes as $attr ) {
115
+
116
+ if(in_array($attr->getAttributecode(),$this->_exclude_attribute)) continue;
117
+ if ($attr->getBackendType () == 'varchar' || $attr->getBackendType () == 'text') {
118
+ $word_count = 0;
119
+ foreach($productCollection as $product){
120
+ $word_count += Mage::helper ( 'textmaster' )->countWord($product->getData($attr->getAttributecode()));
121
+ }
122
+ if($first){
123
+ $aResult [] = array (
124
+ 'value' => $attr->getAttributeId(),
125
+ 'label' => Mage::helper('catalog')->__($attr->getFrontendLabel ()) . ' - <span class="tprice">'.$word_count.'</span> '.Mage::helper('textmaster')->__('word(s)')
126
+ );
127
+ }
128
+ $aAfterJs[$store->getId()][$attr->getAttributeId()] = $word_count;
129
+ }
130
+ }
131
+ $first = false;
132
+ }
133
+ $tarifs = $_api->getPricings();
134
+ $currency = Mage::getModel('directory/currency')->load($tarifs['code']);
135
+ $curr = Mage::app()->getLocale()->currency($currency->getCode());
136
 
137
+ if($this->getProject() && $this->getProject()->hasDocumentsNotCount()) {
138
+ $docs = $this->getProject()->getDocuments();
139
+ $docsc = $this->getProject()->getDocumentsNotCount();
140
+ $ndoc = count($docs);
141
+ $ndocc = count($docsc);
142
+ $nd = $ndoc-$ndocc;
143
+ $nd = $nd / $ndoc;
144
+ $r = round($nd,2)*100;
145
+ } else {
146
+ $r = 100;
147
+ }
148
+ $attributes = $fieldset->addField ( 'attribute', 'checkboxes', array (
149
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Product informations' ),
150
+ 'name' => 'attribute[]',
151
+ 'values' => $aResult
152
+ ) )->setAfterElementHtml('
153
+ <button id="all-attributes">'.Mage::helper ( 'textmaster' )->__ ( 'Select all' ).'</button>
154
+ <button id="notall-attributes">'.Mage::helper ( 'textmaster' )->__ ( 'Deselect all' ).'</button>
155
+ <script>
156
  var attribute_word_count = '.Mage::helper('core')->jsonEncode($aAfterJs).';
157
+ var nouveau_message_loader = "'.Mage::helper ( 'textmaster' )->__ ( 'Nouveau message variable' ).'";
158
+ var message_loader_tm = "'.Mage::helper ( 'textmaster' )->__ ( 'message_loader_tm' ).'";
159
+ var must_display_loader = '.($this->getProject() && ($this->getProject()->hasDocumentsNotCount() || ($this->getProject()->getTranslationMemory() && ($this->getProject()->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_IN_PROGRESS || $this->getProject()->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_COMPLETED))) ?"true":'false').';
160
+ var pourcent_avance = '.$r.';
161
+ var textmasterurl_count = "'.($this->getProject()?Mage::getSingleton('adminhtml/url')->getUrl('*/*/createprojectready',array('id'=>$this->getProject()->getId())):'').'";
162
+ var currency_symbol = "'.$curr->getSymbol().'";
163
  </script>');
164
+
165
+
166
+
167
+ $fieldset = $form->addFieldset ( 'project_languages', array (
168
+ 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Languages' )
169
+ ) );
170
+
171
+ $languages = $_api->getLanguages ();
172
+ $used_language = array();
173
+ foreach ($languages as $language){
174
+ $used_language[] = $language['code'];
175
+ }
176
+
177
+ $stores = Mage::getModel('core/store')->getCollection();
178
+
179
+ $languagesSelect = array ();
180
+ $correspondances = array ();
181
+ $languagesSelect [''] = Mage::helper ( 'textmaster' )->__ ( 'Select a language' );
182
+ foreach($stores as $store) {
183
+ // $code = Mage::getStoreConfig('general/locale/code',$store->getId());
184
+ // $local = explode('_',$code);
185
+ $local = Mage::helper('textmaster')->getFormatedLangCode($store->getId());
186
+ if(in_array($local,$used_language))
187
+ $languagesSelect [$store->getId()] = $store->getWebsite()->getName().' - '.$store->getName();
188
+ $correspondances[$store->getId()] = $local;
189
+ }
190
+
191
+
192
+
193
+ $fieldset->addField ( 'store_id_origin', 'select', array (
194
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Source language' ),
195
+ 'class' => 'required-entry',
196
+ 'required' => true,
197
+ 'name' => 'store_id_origin',
198
+ 'values' => $languagesSelect,
199
+ 'disabled' => false,
200
+ 'readonly' => false
201
+ ) );
202
+
203
+ $language_to = $fieldset->addField ( 'store_id_translation', 'select', array (
204
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Target language' ),
205
+ 'class' => 'required-entry',
206
+ 'required' => true,
207
+ 'name' => 'store_id_translation',
208
+ 'values' => $languagesSelect,
209
+ 'disabled' => false,
210
+ 'readonly' => false
211
+ ) );
212
+
213
+ $this->setChild ( 'form_after', $this->getLayout ()->createBlock ( 'adminhtml/widget_form_element_dependence' )->addFieldMap ( $ctype->getHtmlId (), $ctype->getName () )->addFieldMap ( $language_to->getHtmlId (), $language_to->getName () )->addFieldDependence ( $language_to->getName (), $ctype->getName (), Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION ) );
214
+
215
+
216
+
217
+
218
+ $fieldset = $form->addFieldset ( 'project_options', array (
219
+ 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Pricing options' )
220
+ ));
221
+
222
+
223
 
224
+ $fieldset->addField('language_level', 'select', array(
225
+ 'label' => Mage::helper('textmaster')->__('Service level'),
226
+ 'name' => 'language_level',
227
+ 'required' => true,
228
+ 'values' => array(
229
+ // Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_REGULAR),
230
+ Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM => 'Standard',
231
+ Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_ENTERPRISE => ucfirst(Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_ENTERPRISE),
232
+ ),
233
  // Mage::helper('textmaster')->__('Regular (%s/word): native-speaking translator for word-for-word translations of short texts.',$currency->format($tarifs['types']['translation']['regular'])).'<br/>'.
234
+ 'after_element_html' => '<br/><small>'.
235
+ Mage::helper('textmaster')->__('Standard (%s/word): experienced translator; suitable for business use.',$currency->format($tarifs['types']['translation']['premium'])) .'<br/>'.
236
+ Mage::helper('textmaster')->__('Enterprise (%s/word): professional translator specialized in a specific field; suitable for technical or complex content.',$currency->format($tarifs['types']['translation']['enterprise'])) .'<br/>'.
237
+ '</small>',
238
+ ));
239
+
240
+
241
+ $fieldset->addField ( 'quality', 'select', array (
242
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Quality Control (+%s/word)', $currency->format($tarifs['types']['translation']['quality'],array(),false)),
243
+ 'name' => 'quality',
244
+ 'required' => true,
245
+ 'values' => array(
246
+ Mage::helper ( 'textmaster' )->__ ( 'No' ),
247
+ Mage::helper ( 'textmaster' )->__ ( 'Yes' )
248
+ ),
249
+ 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('The translator\'s work will be proofread and corrected by TextMaster').'</small>',
250
+ ) );
251
+ $fieldset->addField ( 'priority', 'select', array (
252
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Priority Order (+%s/word)', $currency->format($tarifs['types']['translation']['priority'],array(),false) ),
253
+ 'name' => 'priority',
254
+ 'required' => true,
255
+ 'values' => array(
256
+ Mage::helper ( 'textmaster' )->__ ( 'No' ),
257
+ Mage::helper ( 'textmaster' )->__ ( 'Yes' )
258
+ ),
259
+ 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('Your project will be assigned a higher priority status.').'</small>',
260
+ ) );
261
+ // $fieldset->addField ( 'expertise', 'select', array (
262
+ // 'label' => Mage::helper ( 'textmaster' )->__ ( 'Expertise (+%s/word)', $currency->format($tarifs['types']['translation']['expertise'],array(),false) ),
263
+ // 'name' => 'expertise',
264
+ // 'required' => true,
265
+ // 'values' => array(
266
+ // Mage::helper ( 'textmaster' )->__ ( 'No' ),
267
+ // Mage::helper ( 'textmaster' )->__ ( 'Yes' )
268
+ // ),
269
+ // 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('We provide you with an expert in the selected category.').'</small>',
270
+
271
+ // ) );
272
+ $fieldset->addField('translation_memory', 'select', array (
273
+ 'label' => Mage::helper('textmaster')->__('Translation memory (+%s/word)', $currency->format($tarifs['types']['translation']['translation_memory'], array(), false)),
274
+ 'name' => 'translation_memory',
275
+ 'disabled' => 'disabled',
276
+ 'required' => true,
277
+ 'values' => array(
278
+ Mage::helper ( 'textmaster' )->__ ( 'No' ),
279
+ Mage::helper ( 'textmaster' )->__ ( 'Yes' )
280
+ ),
281
+ 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('We will find some words in our database').'</small>',
282
+
283
+ ) );
284
 
285
+ if (Mage::helper('textmaster')->getNegotiatedContracts()) {
286
+ $fieldset->addField('negotiated_contract', 'select', array (
287
+ 'label' => Mage::helper('textmaster')->__('Negotiated contracts'),
288
+ 'name' => 'negotiated_contract',
289
+ 'required' => false,
290
+ 'values' => Mage::helper('textmaster')->getNegotiatedContractsFormated(),
291
+ // 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('We will find some words in our database').'</small>',
292
+ ));
293
+ }
294
+
295
+ $fieldset = $form->addFieldset ( 'project_name', array (
296
+ 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Instructions du projet' )
297
+ ));
298
+
299
+ $fieldset->addField ( 'name', 'text', array (
300
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Name' ),
301
+ 'class' => 'required-entry',
302
+ 'required' => true,
303
+ 'name' => 'name'
304
+ ));
305
+
306
+ $html_briefing = '<script>
307
  var briefing_translation = new Array();
308
  var briefing_proofreading = new Array();'."\n";
309
+ foreach ($languages as $langue) {
310
+ $html_briefing .= 'briefing_translation[\''.$langue['code'].'\'] = \''.addslashes(Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_translation_'.$langue['code'])).'\';'."\n";
311
+ $html_briefing .= 'briefing_proofreading[\''.$langue['code'].'\'] = \''.addslashes(Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_proofreading_'.$langue['code'])).'\';'."\n";
312
+ }
313
+ $html_briefing .= 'store_langue_correspondance = '.json_encode($correspondances).';'."\n";
314
+
315
+ $html_briefing .= '</script>';
316
+
317
+ $fieldset->addField ( 'project_briefing', 'textarea', array (
318
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Briefing' ),
319
+ 'class' => 'required-entry',
320
+ 'required' => true,
321
+ 'name' => 'project_briefing'
322
+ ))->setAfterElementHtml($html_briefing);
323
+
324
+ $categories = $_api->getCategories();
325
+ $categoriesSelect = array ();
326
+ $categoriesSelect [-1] = Mage::helper ( 'textmaster' )->__ ( 'Select a category' );
327
+ foreach ( $categories as $categorie ) {
328
+
329
+ $categoriesSelect [$categorie ["code"]] = $categorie ["value"];
330
+ }
331
+
332
+ $fieldset->addField ( 'category', 'select', array (
333
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Category (optional)' ),
334
+ 'name' => 'category',
335
+ 'values' => $categoriesSelect,
336
+ 'disabled' => false,
337
+ 'readonly' => false
338
+ ) );
339
+
340
+ $fieldset->addField ( 'same_author_must_do_entire_project', 'select', array (
341
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Single Author (Assign the entire project to a single TextMaster)' ),
342
+ 'name' => 'same_author_must_do_entire_project',
343
+ 'required' => true,
344
+ 'values' => array(
345
+ Mage::helper ( 'textmaster' )->__ ( 'Non' ),
346
+ Mage::helper ( 'textmaster' )->__ ( 'Oui' )
347
+ ),
348
+ 'after_element_html' => '<br/><small>'.Mage::helper('textmaster')->__('Ensures better continuity, but longer turnaround time').'</small>',
349
+
350
+ ) );
351
+
352
+ $this->setChild ( 'form_after',
353
+ $this->getLayout ()->createBlock('adminhtml/widget_form_element_dependence')
354
+ ->addFieldMap($ctype->getHtmlId(),$ctype->getName())
355
+ ->addFieldMap($language_to->getHtmlId(), $language_to->getName())
356
+ ->addFieldDependence($language_to->getName(), $ctype->getName(), Textmaster_Textmaster_Model_Project::PROJECT_CTYPE_TRANSLATION )
357
+ );
358
+
359
+ $this->setFormValues();
360
+
361
+
362
+ return parent::_prepareForm ();
363
+ }
364
+
365
+ public function setFormValues(){
366
+
367
+ if($this->getProject()){
368
+ $post = $this->getProject()->getData();
369
+ $authors = $this->getProject()->getTextmasters();
370
+ if(count($authors)) {
371
+ $post['ismytextmaster'] = 1;
372
+ }
373
+ $post['attribute'] = array();
374
+ foreach($this->getProject()->getAttributes() as $attribute){
375
+ $post['attribute'][] = $attribute->getTextmasterAttributeId();
376
+ }
377
+ } else {
378
+ $post = Mage::getSingleton('core/session')->getProjectInfo();
379
+ if(!$post || count($post)==0){
380
+ $post['quality'] = 1;
381
+ $post['language_level'] = Textmaster_Textmaster_Model_Project::PROJECT_LANGUAGE_LEVEL_PREMIUM;
382
+ $post['attribute'] = array();
383
+ if($this->_name_attribute_id){
384
+ $post['attribute'][] = $this->_name_attribute_id;
385
+ }
386
+ if($this->_description_attribute_id){
387
+ $post['attribute'][] = $this->_description_attribute_id;
388
+ }
389
+ if($this->_short_description_attribute_id){
390
+ $post['attribute'][] = $this->_short_description_attribute_id;
391
+ }
392
+ $post['ctype'] = Mage::getStoreConfig('textmaster/defaultvalue/default_type');
393
+
394
+
395
+ $used_language = Mage::getStoreConfig('textmaster/defaultvalue/default_language');
396
+ $stores = Mage::getModel('core/store')->getCollection();
397
+ $current_locale = '';
398
+ foreach ( $stores as $store ) {
399
+ $code = Mage::getStoreConfig('general/locale/code',$store->getId());
400
+ $local = explode('_',$code);
401
+ if($local[0]==$used_language) {
402
+ $post['store_id_origin'] = $store->getId();
403
+ $current_locale = $local[0];
404
+ }
405
+ }
406
+ if($post['ctype']!='translation' && $post['ctype']!='proofreading')
407
+ $post['ctype']='translation';
408
+ $post['project_briefing'] = Mage::getStoreConfig('textmaster/defaultvalue/briefing_message_'.$post['ctype'].'_'.$current_locale);
409
+ $post['same_author_must_do_entire_project'] = Mage::getStoreConfig('textmaster/defaultvalue/single_author');
410
+ $post['expertise'] = Mage::getStoreConfig('textmaster/defaultvalue/expertise');
411
+ //Commerce (C019) par default
412
+ $post['category'] = Mage::getStoreConfig('textmaster/defaultvalue/category')?Mage::getStoreConfig('textmaster/defaultvalue/category'):'C019';
413
+
414
+ }
415
+ }
416
+
417
+ //$post['word_count'] = $word_count;
418
+ if ($post) {
419
+ $this->getForm()->setValues ( $post );
420
+ }
421
+ }
422
+
423
+ public function setProject($project){
424
+ $this->_project = $project;
425
+ return $this;
426
+ }
427
+
428
+ public function getProject(){
429
+ return $this->_project;
430
+ }
431
+
432
  }
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Step3.php CHANGED
@@ -116,39 +116,39 @@ class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step3 extends Mage_A
116
  $this->setFormValues();
117
 
118
  return parent::_prepareForm ();
119
- }
120
-
121
- public function setFormValues(){
122
- $_api = Mage::helper('textmaster')->getApi();
123
-
124
- $post = $this->getProject()->getData();
125
-
126
- $store_from = Mage::getModel('core/store')->load($post['store_id_origin']);
127
- $store_to = Mage::getModel('core/store')->load($post['store_id_translation']);
128
- $post['ctype'] = ucfirst($post['ctype']);
129
- $post['store_id_origin'] = $store_from->getWebsite()->getName().' - '.$store_from->getName();
130
- $post['store_id_translation'] = $store_to->getWebsite()->getName().' - '.$store_to->getName();
131
- $tarifs = $_api->getPricings();
132
- $currency = Mage::getModel('directory/currency')->load($tarifs['code']);
133
-
134
- $userinfo = $_api->getUserInfo();
135
-
136
- if(isset($userinfo['wallet']['current_money']))
137
- $credit = (float) $userinfo['wallet']['current_money'];
138
- else $credit = 0;
139
-
140
- $project_price = (float) $post['price'];
141
- if($post['total_word_count'])
142
- $price_per_word = $project_price/$post['total_word_count'];
143
- else
144
- $price_per_word = 0;
145
- $post['price'] = $currency->format($post['price'],array(),false);
146
- $html = $post['price'];
147
- $html .='<br/><span>'.Mage::helper('textmaster')->__('Crédit disponible :').' '.$currency->format($credit).'</span>';
148
- if($project_price>$credit) {
149
- $html .='<br/><span style="color:red">'.Mage::helper('textmaster')->__('Crédit manquant :'). $currency->format(($project_price-$credit), array(), false).'</span>';
150
- $html .='<br/><a href="'.$_api->getInterfaceUri().'clients/payment_requests/new?project_id='.$this->getProject()->getProjectApiid().'" target="_blank">'.Mage::helper('textmaster')->__('Add credits to my TextMaster account').'</a>';
151
- }
152
 
153
  $this->getForm()->getElement('price')->setAfterElementHtml($html);
154
 
@@ -157,19 +157,25 @@ class Textmaster_Textmaster_Block_Adminhtml_Project_Onglets_Step3 extends Mage_A
157
  if (Mage::helper('textmaster')->showProjectDiffWordCount($this->getProject())){
158
  $post['total_word_count_saved'] = $this->getProject()->getDiffWordCount();
159
  }
160
-
161
- $html = $this->getProject()->getLanguageLevelTexte($post['language_level']).'<br/>';
162
- if($post['quality']) {
163
- $html .= Mage::helper( 'textmaster' )->__( 'Contrôle qualité (+%s / mot)' ,$currency->format($tarifs['types']['translation']['quality'],array(),false)).'<br/>';
164
- }
165
- if($post['priority']) {
166
- $html .= Mage::helper( 'textmaster' )->__( 'Commande prioritaire (+%s / mot)',$currency->format($tarifs['types']['translation']['priority'],array(),false) ).'<br/>';
167
- }
168
- if($post['expertise']) {
169
- $html .= Mage::helper( 'textmaster' )->__( 'Expertise (+%s / mot)',$currency->format($tarifs['types']['translation']['expertise'],array(),false) ).'<br/>';
170
- }
171
  if($post['translation_memory']) {
172
  $html .= Mage::helper( 'textmaster' )->__( 'Translation memory (+%s/word)', $currency->format($tarifs['types']['translation']['translation_memory'],array(),false) ).'<br/>';
 
 
 
 
 
 
173
  }
174
  $html .= Mage::helper( 'textmaster' )->__('%s/word',$currency->format($price_per_word,array(),false));
175
 
116
  $this->setFormValues();
117
 
118
  return parent::_prepareForm ();
119
+ }
120
+
121
+ public function setFormValues(){
122
+ $_api = Mage::helper('textmaster')->getApi();
123
+
124
+ $post = $this->getProject()->getData();
125
+
126
+ $store_from = Mage::getModel('core/store')->load($post['store_id_origin']);
127
+ $store_to = Mage::getModel('core/store')->load($post['store_id_translation']);
128
+ $post['ctype'] = ucfirst($post['ctype']);
129
+ $post['store_id_origin'] = $store_from->getWebsite()->getName().' - '.$store_from->getName();
130
+ $post['store_id_translation'] = $store_to->getWebsite()->getName().' - '.$store_to->getName();
131
+ $tarifs = $_api->getPricings();
132
+ $currency = Mage::getModel('directory/currency')->load($tarifs['code']);
133
+
134
+ $userinfo = $_api->getUserInfo();
135
+
136
+ if(isset($userinfo['wallet']['current_money']))
137
+ $credit = (float) $userinfo['wallet']['current_money'];
138
+ else $credit = 0;
139
+
140
+ $project_price = (float) $post['price'];
141
+ if($post['total_word_count'])
142
+ $price_per_word = $project_price/$post['total_word_count'];
143
+ else
144
+ $price_per_word = 0;
145
+ $post['price'] = $currency->format($post['price'],array(),false);
146
+ $html = $post['price'];
147
+ $html .='<br/><span>'.Mage::helper('textmaster')->__('Crédit disponible :').' '.$currency->format($credit).'</span>';
148
+ if($project_price>$credit) {
149
+ $html .='<br/><span style="color:red">'.Mage::helper('textmaster')->__('Crédit manquant :'). $currency->format(($project_price-$credit), array(), false).'</span>';
150
+ $html .='<br/><a href="'.$_api->getInterfaceUri().'clients/payment_requests/new?project_id='.$this->getProject()->getProjectApiid().'" target="_blank">'.Mage::helper('textmaster')->__('Add credits to my TextMaster account').'</a>';
151
+ }
152
 
153
  $this->getForm()->getElement('price')->setAfterElementHtml($html);
154
 
157
  if (Mage::helper('textmaster')->showProjectDiffWordCount($this->getProject())){
158
  $post['total_word_count_saved'] = $this->getProject()->getDiffWordCount();
159
  }
160
+
161
+ $html = $this->getProject()->getLanguageLevelTexte($post['language_level']).'<br/>';
162
+ if($post['quality']) {
163
+ $html .= Mage::helper( 'textmaster' )->__( 'Contrôle qualité (+%s / mot)' ,$currency->format($tarifs['types']['translation']['quality'],array(),false)).'<br/>';
164
+ }
165
+ if($post['priority']) {
166
+ $html .= Mage::helper( 'textmaster' )->__( 'Commande prioritaire (+%s / mot)',$currency->format($tarifs['types']['translation']['priority'],array(),false) ).'<br/>';
167
+ }
168
+ if($post['expertise']) {
169
+ $html .= Mage::helper( 'textmaster' )->__( 'Expertise (+%s / mot)',$currency->format($tarifs['types']['translation']['expertise'],array(),false) ).'<br/>';
170
+ }
171
  if($post['translation_memory']) {
172
  $html .= Mage::helper( 'textmaster' )->__( 'Translation memory (+%s/word)', $currency->format($tarifs['types']['translation']['translation_memory'],array(),false) ).'<br/>';
173
+ }
174
+ if(isset($post['negotiated_contract'])) {
175
+ $negotiatedContractsPricing = Mage::helper('textmaster')->getNegotiatedContractsPricing();
176
+ $negotiatedContractPrice = $negotiatedContractsPricing[$post['negotiated_contract']];
177
+ $html .= Mage::helper('textmaster')->__('Negotiated contract (%s/word)', $currency->format($negotiatedContractPrice), array(), false).'<br/>';
178
+ // $html .= Mage::helper('textmaster')->__('Negotiated contract').'<br/>';
179
  }
180
  $html .= Mage::helper( 'textmaster' )->__('%s/word',$currency->format($price_per_word,array(),false));
181
 
app/code/community/Textmaster/Textmaster/Block/Adminhtml/Project/Onglets/Summary.php CHANGED
@@ -36,7 +36,7 @@
36
  )
37
  );
38
  $fieldset = $form->addFieldset ( 'project_pricing', array (
39
- 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Order Summary' )
40
  ) );
41
  $projetField = $fieldset->addField ( 'projet', 'label', array(
42
  'label' => Mage::helper ( 'textmaster' )->__ ('Project'),
@@ -45,7 +45,7 @@
45
  'label' => Mage::helper ( 'textmaster' )->__ ('Word count'),
46
  ));
47
  $optionsField = $fieldset->addField ( 'options', 'label', array(
48
- 'label' => Mage::helper ( 'textmaster' )->__ ('Level and options'),
49
  ));
50
 
51
  $pricingField = $fieldset->addField ( 'pricing', 'label', array(
@@ -53,7 +53,9 @@
53
  ));
54
 
55
  $pricing = $_api->getPricings();
 
56
  $pricing = Mage::helper('core')->jsonEncode($pricing);
 
57
  $projetField->setAfterElementHtml('<span id="textmaster_projet"></span>');
58
  $optionsField->setAfterElementHtml('<span id="textmaster_options"></span>');
59
  $nbmotField->setAfterElementHtml('<span id="textmaster_nbmot"></span>');
@@ -61,6 +63,7 @@
61
  <span id="textmaster_total_price"></span>
62
  <script>
63
  var textmaster_pricing = '.$pricing.';
 
64
  var textmaster_edit_form_url = \''.$this->getUrl('*/*/edit', array('step' => 2)).'\';
65
  </script>');
66
  $form->setUseContainer(true);
36
  )
37
  );
38
  $fieldset = $form->addFieldset ( 'project_pricing', array (
39
+ 'legend' => Mage::helper ( 'textmaster' )->__ ( 'Order Summary' )
40
  ) );
41
  $projetField = $fieldset->addField ( 'projet', 'label', array(
42
  'label' => Mage::helper ( 'textmaster' )->__ ('Project'),
45
  'label' => Mage::helper ( 'textmaster' )->__ ('Word count'),
46
  ));
47
  $optionsField = $fieldset->addField ( 'options', 'label', array(
48
+ 'label' => Mage::helper ( 'textmaster' )->__ ('Level and options'),
49
  ));
50
 
51
  $pricingField = $fieldset->addField ( 'pricing', 'label', array(
53
  ));
54
 
55
  $pricing = $_api->getPricings();
56
+ $negotiatedContractPricing = Mage::helper('textmaster')->getNegotiatedContractsPricing();
57
  $pricing = Mage::helper('core')->jsonEncode($pricing);
58
+ $negotiatedContractPrices = Mage::helper('core')->jsonEncode($negotiatedContractPricing);
59
  $projetField->setAfterElementHtml('<span id="textmaster_projet"></span>');
60
  $optionsField->setAfterElementHtml('<span id="textmaster_options"></span>');
61
  $nbmotField->setAfterElementHtml('<span id="textmaster_nbmot"></span>');
63
  <span id="textmaster_total_price"></span>
64
  <script>
65
  var textmaster_pricing = '.$pricing.';
66
+ var textmaster_negotiated_contract_prices = '.$negotiatedContractPrices.';
67
  var textmaster_edit_form_url = \''.$this->getUrl('*/*/edit', array('step' => 2)).'\';
68
  </script>');
69
  $form->setUseContainer(true);
app/code/community/Textmaster/Textmaster/Helper/Data.php CHANGED
@@ -163,6 +163,11 @@ class Textmaster_Textmaster_Helper_Data extends Mage_Core_Helper_Abstract
163
  return strtolower(str_replace('_', '-', Mage::getStoreConfig('general/locale/code',$storeId)));
164
  }
165
 
 
 
 
 
 
166
  public function showProjectDiffWordCount($project){
167
  $totalWordCount = $project->getTotalWordCount();
168
  if(!$project->getTranslationMemory() or $totalWordCount == 0)
@@ -172,4 +177,34 @@ class Textmaster_Textmaster_Helper_Data extends Mage_Core_Helper_Abstract
172
  return true;
173
  return false;
174
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
163
  return strtolower(str_replace('_', '-', Mage::getStoreConfig('general/locale/code',$storeId)));
164
  }
165
 
166
+ /**
167
+ * Return true if translation memory is enable and with have 5% diff word count
168
+ * @param $project
169
+ * @return boolean
170
+ */
171
  public function showProjectDiffWordCount($project){
172
  $totalWordCount = $project->getTotalWordCount();
173
  if(!$project->getTranslationMemory() or $totalWordCount == 0)
177
  return true;
178
  return false;
179
  }
180
+
181
+ public function getNegotiatedContracts(){
182
+ $negotiatedContracts = Mage::getModel('textmaster/api')->getNegotiatedContracts();
183
+ $negotiatedContracts = $negotiatedContracts['negotiated_contracts'];
184
+ return $negotiatedContracts;
185
+ }
186
+
187
+ public function getNegotiatedContractsFormated(){
188
+ $negotiatedContracts = $this->getNegotiatedContracts();
189
+ $negotiatedContractsField = array('' => $this->__('No contract selected'));
190
+ $currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
191
+ $currencySymbol = Mage::app()->getLocale()->currency($currencyCode)->getSymbol();
192
+ $symbol = '';
193
+ foreach ($negotiatedContracts as $negotiatedContract) {
194
+ if($negotiatedContract['client_pricing_in_locale'] > 0)
195
+ $symbol = '+';
196
+ $price = $symbol.$negotiatedContract['client_pricing_in_locale'].$currencySymbol;
197
+ $negotiatedContractsField[$negotiatedContract['id']] = $negotiatedContract['name'].' '.$this->__('(%s/word)', $price, array(), false);
198
+ }
199
+ return $negotiatedContractsField;
200
+ }
201
+
202
+ public function getNegotiatedContractsPricing(){
203
+ $negotiatedContracts = $this->getNegotiatedContracts();
204
+ $negotiatedContractsPrices = array();
205
+ foreach ($negotiatedContracts as $negotiatedContract) {
206
+ $negotiatedContractsPrices[$negotiatedContract['id']] = $negotiatedContract['client_pricing_in_locale'];
207
+ }
208
+ return $negotiatedContractsPrices;
209
+ }
210
  }
app/code/community/Textmaster/Textmaster/Model/Api.php CHANGED
@@ -44,6 +44,8 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
44
 
45
  protected $_users_me = false;
46
 
 
 
47
  const TEXTMASTER_API_VERSION = 'v1';
48
 
49
  const TEXTMASTER_PROD_API_URI = 'http://api.textmaster.com';
@@ -204,7 +206,8 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
204
  $info = curl_getinfo($curl);
205
 
206
  // Mage::log(Mage::helper('core')->jsonEncode($data),null,'textmaster.log');
207
- //Mage::log($info,null,'textmaster.log');
 
208
 
209
 
210
  if ($info['http_code'] == '500') {
@@ -802,6 +805,16 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
802
  return $audience;
803
  }
804
 
 
 
 
 
 
 
 
 
 
 
805
  public function getPricings ($word_count = 1)
806
  {
807
  if ($this->_prices)
@@ -893,6 +906,7 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
893
  'language_level' => $parameters['language_level'],
894
  'quality' => isset($parameters['quality']) ? $parameters['quality'] : '0',
895
  'translation_memory' => isset($parameters['translation_memory']) ? $parameters['translation_memory'] : '0',
 
896
  'specific_attachment' => isset($parameters['specific_attachment']) ? $parameters['specific_attachment'] : '0',
897
  'priority' => isset($parameters['priority']) ? $parameters['priority'] : '0',
898
  'uniq_author' => isset($parameters['same_author_must_do_entire_project']) ? $parameters['same_author_must_do_entire_project'] : '0'
@@ -902,6 +916,7 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
902
  $parameters['quality'],
903
  $parameters['expertise'],
904
  $parameters['translation_memory'],
 
905
  $parameters['specific_attachment'],
906
  $parameters['priority'],
907
  $parameters['same_author_must_do_entire_project']
@@ -932,6 +947,7 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
932
  'tracker' => self::TEXTMASTER_TRACKER_ID
933
  );
934
 
 
935
  if ($quotation)
936
  return $this->_post('projects/quotation', $data, 'get');
937
  return $this->_post('projects', $data);
@@ -947,6 +963,7 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
947
  'language_level' => $parameters['language_level'],
948
  'quality' => isset($parameters['quality']) ? $parameters['quality'] : '0',
949
  'translation_memory' => isset($parameters['translation_memory']) ? $parameters['translation_memory'] : '0',
 
950
  'specific_attachment' => isset($parameters['specific_attachment']) ? $parameters['specific_attachment'] : '0',
951
  'priority' => isset($parameters['priority']) ? $parameters['priority'] : '0',
952
  'uniq_author' => isset($parameters['same_author_must_do_entire_project']) ? $parameters['same_author_must_do_entire_project'] : '0',
@@ -956,6 +973,7 @@ class Textmaster_Textmaster_Model_Api extends Mage_Core_Model_Abstract
956
  $parameters['quality'],
957
  $parameters['expertise'],
958
  $parameters['translation_memory'],
 
959
  $parameters['specific_attachment'],
960
  $parameters['priority'],
961
  $parameters['same_author_must_do_entire_project']
44
 
45
  protected $_users_me = false;
46
 
47
+ protected $_negotiated_contracts = array();
48
+
49
  const TEXTMASTER_API_VERSION = 'v1';
50
 
51
  const TEXTMASTER_PROD_API_URI = 'http://api.textmaster.com';
206
  $info = curl_getinfo($curl);
207
 
208
  // Mage::log(Mage::helper('core')->jsonEncode($data),null,'textmaster.log');
209
+ // Mage::log($info,null,'textmaster.log');
210
+ // Mage::log($result,null,'textmaster.log');
211
 
212
 
213
  if ($info['http_code'] == '500') {
805
  return $audience;
806
  }
807
 
808
+ public function getNegotiatedContracts(){
809
+ if($this->_negotiated_contracts)
810
+ return $this->_negotiated_contracts;
811
+
812
+ $negotiatedContracts = $this->_request("negotiated_contracts?per_page=100", false, true);
813
+ $this->_negotiated_contracts = $negotiatedContracts;
814
+
815
+ return $negotiatedContracts;
816
+ }
817
+
818
  public function getPricings ($word_count = 1)
819
  {
820
  if ($this->_prices)
906
  'language_level' => $parameters['language_level'],
907
  'quality' => isset($parameters['quality']) ? $parameters['quality'] : '0',
908
  'translation_memory' => isset($parameters['translation_memory']) ? $parameters['translation_memory'] : '0',
909
+ 'negotiated_contract' => isset($parameters['negotiated_contract']) ? $parameters['negotiated_contract'] : '',
910
  'specific_attachment' => isset($parameters['specific_attachment']) ? $parameters['specific_attachment'] : '0',
911
  'priority' => isset($parameters['priority']) ? $parameters['priority'] : '0',
912
  'uniq_author' => isset($parameters['same_author_must_do_entire_project']) ? $parameters['same_author_must_do_entire_project'] : '0'
916
  $parameters['quality'],
917
  $parameters['expertise'],
918
  $parameters['translation_memory'],
919
+ $parameters['negotiated_contract'],
920
  $parameters['specific_attachment'],
921
  $parameters['priority'],
922
  $parameters['same_author_must_do_entire_project']
947
  'tracker' => self::TEXTMASTER_TRACKER_ID
948
  );
949
 
950
+
951
  if ($quotation)
952
  return $this->_post('projects/quotation', $data, 'get');
953
  return $this->_post('projects', $data);
963
  'language_level' => $parameters['language_level'],
964
  'quality' => isset($parameters['quality']) ? $parameters['quality'] : '0',
965
  'translation_memory' => isset($parameters['translation_memory']) ? $parameters['translation_memory'] : '0',
966
+ 'negotiated_contract' => isset($parameters['negotiated_contract']) ? $parameters['negotiated_contract'] : '',
967
  'specific_attachment' => isset($parameters['specific_attachment']) ? $parameters['specific_attachment'] : '0',
968
  'priority' => isset($parameters['priority']) ? $parameters['priority'] : '0',
969
  'uniq_author' => isset($parameters['same_author_must_do_entire_project']) ? $parameters['same_author_must_do_entire_project'] : '0',
973
  $parameters['quality'],
974
  $parameters['expertise'],
975
  $parameters['translation_memory'],
976
+ $parameters['negotiated_contract'],
977
  $parameters['specific_attachment'],
978
  $parameters['priority'],
979
  $parameters['same_author_must_do_entire_project']
app/code/community/Textmaster/Textmaster/Model/Project.php CHANGED
@@ -138,7 +138,7 @@
138
  if(!isset($data_api['error'])){
139
  $this->project_loaded = true;
140
  if(isset($data_api['options']['language_level']))
141
- $this->setLanguageLevel($data_api['options']['language_level']);
142
  else
143
  $this->setLanguageLevel('regular');
144
  if(isset($data_api['reference']))
@@ -156,7 +156,7 @@
156
  $this->setProjectBriefing($data_api['project_briefing']);
157
 
158
  if(isset($data_api['options']['specific_attachment']))
159
- $this->setSpecificAttachment($data_api['options']['specific_attachment']);
160
  else
161
  $this->setSpecificAttachment(0);
162
 
@@ -170,22 +170,24 @@
170
  $this->setPrice(0);
171
  }
172
  if(isset($data_api['options']['priority']))
173
- $this->setPriority($data_api['options']['priority']);
174
  else {
175
  $this->setPriority(0);
176
  }
177
  if(isset($data_api['options']['quality']))
178
- $this->setQuality($data_api['options']['quality']);
179
  else {
180
  $this->setQuality(0);
181
  }
182
  if(isset($data_api['options']['expertise']))
183
- $this->setExpertise($data_api['options']['expertise']);
184
  else {
185
  $this->setExpertise(0);
186
  }
187
  if(isset($data_api['options']['translation_memory']))
188
- $this->setTranslationMemory($data_api['options']['translation_memory']);
 
 
189
 
190
  //TODO
191
  $this->setIsmytextmaster(0);
@@ -628,7 +630,7 @@
628
  Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
629
  $this->setStatus(self::PROJECT_STATUS_IN_LAUNCH_PROCESSING);
630
  $this->save();
631
- Mage::getSingleton('adminhtml/session')->addSuccess($this->getName().' '.Mage::helper('textmaster')->__('launch'));
632
  return true;
633
  } else {
634
  Mage::getSingleton('adminhtml/session')->addError($this->getName().' '.$result['error']);
138
  if(!isset($data_api['error'])){
139
  $this->project_loaded = true;
140
  if(isset($data_api['options']['language_level']))
141
+ $this->setLanguageLevel($data_api['option_values']['language_level']);
142
  else
143
  $this->setLanguageLevel('regular');
144
  if(isset($data_api['reference']))
156
  $this->setProjectBriefing($data_api['project_briefing']);
157
 
158
  if(isset($data_api['options']['specific_attachment']))
159
+ $this->setSpecificAttachment($data_api['option_values']['specific_attachment']);
160
  else
161
  $this->setSpecificAttachment(0);
162
 
170
  $this->setPrice(0);
171
  }
172
  if(isset($data_api['options']['priority']))
173
+ $this->setPriority($data_api['option_values']['priority']);
174
  else {
175
  $this->setPriority(0);
176
  }
177
  if(isset($data_api['options']['quality']))
178
+ $this->setQuality($data_api['option_values']['quality']);
179
  else {
180
  $this->setQuality(0);
181
  }
182
  if(isset($data_api['options']['expertise']))
183
+ $this->setExpertise($data_api['option_values']['expertise']);
184
  else {
185
  $this->setExpertise(0);
186
  }
187
  if(isset($data_api['options']['translation_memory']))
188
+ $this->setTranslationMemory($data_api['option_values']['translation_memory']);
189
+ if(isset($data_api['options']['negotiated_contract']))
190
+ $this->setNegotiatedContract($data_api['option_values']['negotiated_contract']);
191
 
192
  //TODO
193
  $this->setIsmytextmaster(0);
630
  Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
631
  $this->setStatus(self::PROJECT_STATUS_IN_LAUNCH_PROCESSING);
632
  $this->save();
633
+ Mage::getSingleton('adminhtml/session')->addSuccess($this->getName().' '.Mage::helper('textmaster')->__('launched'));
634
  return true;
635
  } else {
636
  Mage::getSingleton('adminhtml/session')->addError($this->getName().' '.$result['error']);
app/code/community/Textmaster/Textmaster/controllers/Adminhtml/Textmaster/ProjectController.php CHANGED
@@ -11,7 +11,7 @@
11
  * @category Addonline
12
  * @package Textmaster_Textmaster
13
  * @copyright Copyright (c) 2014 Textmaster
14
- * @author Addonline (http://www.addonline.fr)
15
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
  */
17
 
@@ -21,7 +21,7 @@
21
  * @category Addonline
22
  * @package Textmaster_Textmaster
23
  * @copyright Copyright (c) 2014 Textmaster
24
- * @author Addonline (http://www.addonline.fr)
25
  */
26
  class Textmaster_Textmaster_Adminhtml_Textmaster_ProjectController extends Mage_Adminhtml_Controller_Action
27
  {
@@ -30,402 +30,402 @@ class Textmaster_Textmaster_Adminhtml_Textmaster_ProjectController extends Mage_
30
  return Mage::getSingleton('admin/session')->isAllowed('textmaster/projet');
31
  }
32
 
33
- protected function _initAction() {
34
- $this->loadLayout()
35
- ->_setActiveMenu('textmaster/project');
36
- return $this;
37
- }
38
-
39
- public function indexAction()
40
- {
41
- $api_key = Mage::getStoreConfig('textmaster/textmaster/api_key');;
42
- $api_secret = Mage::getStoreConfig('textmaster/textmaster/api_secret');
43
- $user = Mage::helper('textmaster')->getApi()->getUserInfo();
44
- if(!isset($user['email'])) {
45
- $this->_redirect('*/*/login');
46
- } else {
47
- $this->_initAction()->renderLayout();
48
- }
49
- }
50
- public function loginAction()
51
- {
52
- $this->_initAction()->renderLayout();
53
- }
54
-
55
-
56
- public function editAction()
57
- {
58
- /*$projectId = $this->getRequest()->getParam('id');
59
- $projectModel = Mage::getModel('textmaster/project')->load($projectId);*/
60
-
61
- if (/*$projectModel->getId() || $projectId == 0*/1)
62
- {
63
- $step = $this->getRequest()->getParam("step");
64
-
65
- //Mage::register('project_data', $projectModel);
66
- //$this->loadLayout();
67
- $this->_initAction();
68
 
69
-
70
- $ongletBlock = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets')->assign('step', $step);
71
- $ongletBlock->setTemplate('textmaster/onglet.phtml');
72
-
73
- $step1Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step1');
74
- $step2Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step2');
75
- $step3Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step3');
76
-
77
- $this->_addContent($ongletBlock);
78
- switch ($step){
79
- default:
80
- case 1:
81
- $project_id = Mage::getSingleton('core/session')->getProjectId();
82
- $project = Mage::getModel('textmaster/project');
83
- if($project_id && is_numeric($project_id)){
84
- $project->load($project_id);
85
- $docs = $project->getDocuments();
86
- $pids = array();
87
- foreach($docs as $doc){
88
- $pids[] = $doc->getProductId();
89
- }
90
-
91
- $this->getRequest()->setParam('internal_products_id',implode(',',$pids));
92
-
93
- }
94
-
95
- $ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven\'t been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation.'));
96
-
97
-
98
- $this->_addContent($step1Block);
99
- break;
100
- case 2:
101
- $project_id = Mage::getSingleton('core/session')->getProjectId();
102
- $project = Mage::getModel('textmaster/project');
103
- if($project_id && is_numeric($project_id)){
104
- $project->load($project_id);
105
- $step2Block->setProject($project);
106
- }
107
-
108
- $summary = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_summary');
109
- $ongletBlock->setChild('textmaster.step2',$step2Block);
110
- $ongletBlock->setChild('textmaster.summary',$summary);
111
- //$this->_addContent($step2Block);
112
- $ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)'));
113
-
114
-
115
- break;
116
- case 3:
117
- $project_id = Mage::getSingleton('core/session')->getProjectId();
118
- $post = Mage::app()->getRequest()->getPost();
119
- if($post && count($post)){
120
- $project = Mage::getModel('textmaster/project')->load($project_id, null, false);
121
- $r = $project->launch();
122
- if(!isset($r['error'])) {
123
- $this->_redirect('*/*/');
124
- } else {
125
- Mage::getSingleton('adminhtml/session')->addError($r['error']);
126
- $this->_redirect('*/*/edit', array("step" => 3));
127
- }
128
- return ;
129
- }
130
- Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
131
-
132
-
133
- $project = Mage::getModel('textmaster/project')->load($project_id, null, true);
134
- if($project->hasDocumentsNotCount() || ($project->getTranslationMemory() && $project->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_IN_PROGRESS)){
135
- $this->_redirect('*/*/edit', array("step" => 2));
136
- }
137
- $ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com'));
138
- $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
139
- if(empty($products_id)){
140
- $products_id = array();
141
- $documents = $project->getDocuments();
142
- foreach($documents as $document){
143
- $products_id[] = $document->getProductId();
144
- }
145
- Mage::getSingleton('core/session')->setSelectedProducts($products_id);
146
- }
147
-
148
- if($project->canLaunch()){
149
- $ongletBlock->addButton ( 'save', array (
150
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
151
- 'onclick' => 'editForm.submit();',
152
- 'class' => 'save',
153
- ), - 100 );
154
- } else {
155
- $ongletBlock->addButton ( 'save', array (
156
- 'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
157
- 'onclick' => 'editForm.submit();',
158
- 'class' => 'save',
159
- 'disabled'=>'disabled'
160
-
161
- ), - 100 );
162
- }
163
-
164
- $step3Block->setProject($project);
165
-
166
- $ongletBlock->insert($step3Block);
167
-
168
- $this->_addContent($step3Block);
169
-
170
- break;
171
- }
172
-
173
- $this->renderLayout();
174
- }
175
- else
176
- {
177
- Mage::getSingleton('adminhtml/session')
178
- ->addError(Mage::helper('textmaster')->__('Project does not exist'));
179
- $this->_redirect('*/*/');
180
- }
181
- }
182
-
183
- public function newAction()
184
  {
185
- Mage::getSingleton('core/session')->setSelectedProducts(array());
186
- Mage::getSingleton('core/session')->setProjectId(0);
187
- Mage::getSingleton('core/session')->setProjectInfo(array());
188
- $this->_redirect('*/*/edit');
189
- }
190
-
191
- public function massAddAction()
192
- {
193
- $products = $this->getRequest()->getParam('products_id');
194
- if(!is_array($products) || !count($products) || empty($products[0])) {
195
- $this->_redirect('*/*/edit', array("step" => 1));
196
- return;
197
- }
198
- Mage::getSingleton('core/session')->setSelectedProducts($products);
199
-
200
-
201
- $this->_redirect('*/*/edit', array("step" => 2));
202
- }
203
- public function createprojectfromproductAction(){
204
- Mage::getSingleton('core/session')->setSelectedProducts(array());
205
- Mage::getSingleton('core/session')->setProjectId(0);
206
- Mage::getSingleton('core/session')->setProjectInfo(array());
207
-
208
- $product = $this->getRequest()->getParam('id');
209
- Mage::getSingleton('core/session')->setSelectedProducts(array($product));
210
- $this->_redirect('*/*/edit', array("step" => 2));
211
- }
212
-
213
- public function massSendAction()
214
- {
215
- $docs = $this->getRequest()->getParam('document_id');
216
-
217
- //$projectId = $this->getRequest()->getParam('id');
218
- //Mage::getSingleton('core/session')->setSelectedProducts($products);
219
- foreach($docs as $doc){
220
-
221
- Mage::getModel('textmaster/document')->load($doc)->send();
222
- $projectId = Mage::getModel('textmaster/document')->load($doc)->getTextmasterProjectId();
223
- }
224
-
225
- $this->_redirect('*/*/view', array("id" => $projectId));
226
- }
227
-
228
- public function viewAction() {
229
- $projectId = $this->getRequest()->getParam('id');
230
- $projectModel = Mage::getModel('textmaster/project')->load($projectId);
231
- if ($projectModel->getId()) {
232
- if($projectModel->getStatus() == Textmaster_Textmaster_Model_Project::PROJECT_STATUS_IN_CREATION){
233
- Mage::getSingleton('core/session')->setProjectId($projectModel->getId());
234
- if(count($projectModel->getDocuments()))
235
- $this->_redirect('*/*/edit',array('step'=>'3'));
236
- elseif($projectModel->hasDocumentsNotCount())
237
- $this->_redirect('*/*/edit',array('step'=>'2'));
238
- else
239
- $this->_redirect('*/*/edit',array('step'=>'1'));
240
- return;
241
- }
242
-
243
- //ACTIONS
244
- $action = $this->getRequest()->getParam('a');
245
- if($action && is_callable(array($projectModel,$action))){
246
- call_user_func(array($projectModel,$action));
247
- }
248
-
249
- $this->_initAction();
250
- $viewBlock = $this->getLayout()->getBlock('project.view');
251
- $viewBlock->setProject($projectModel);
252
- $viewBlock->prepareButton();
253
- $documentsBlock = $this->getLayout()->getBlock('project.view.documents');
254
- $documentsBlock->setProject($projectModel);
255
-
256
- $this->_addContent($documentsBlock);
257
-
258
-
259
-
260
- $this->renderLayout();
261
- } else {
262
- Mage::getSingleton('adminhtml/session')
263
- ->addError(Mage::helper('textmaster')->__('Project does not exist'));
264
- $this->_redirect('*/*/');
265
- }
266
- }
267
- public function masscompletedocAction() {
268
-
269
- $projectId = $this->getRequest()->getParam('id');
270
- $project = Mage::getModel('textmaster/project')->load($projectId,null,false);
271
- $docs = $this->getRequest()->getParam('document_id');
272
- $doc_api_ids = array();
273
- foreach($docs as $doc_id){
274
- $document = Mage::getModel('textmaster/document')->load($doc_id,null,false);
275
- $document->prepareToComplete();
276
- $doc_api_ids[]=$document->getDocumentApiId();
277
- }
278
-
279
- Mage::helper('textmaster')->getApi()->completeDocuments($project->getProjectApiid(),$doc_api_ids);
280
- $this->getResponse()->setHeader('Content-type', 'application/json');
281
- $this->getResponse()->setBody( Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/doccompleteready',array('id'=>$projectId)))));
282
- //$this->_redirect('*/*/view',array('id'=>$projectId));
283
- }
284
- public function doccompleteAction() {
285
- $documentId = $this->getRequest()->getParam('id');
286
- $document = Mage::getModel('textmaster/document')->load($documentId,null,false);
287
- if ($document->getId()){
288
- $document->sendToComplete();
289
- $json = Mage::helper('core')->jsonEncode(
290
- array('counturl' => $this->getUrl('*/*/doccompleteready',array('id'=>$document->getTextmasterProjectId())))
291
- );
292
- } else {
293
- $json = Mage::helper('core')->jsonEncode(
294
- array()
295
- );
296
- }
297
-
298
- $this->getResponse()->setHeader('Content-type', 'application/json');
299
- $this->getResponse()->setBody($json);
300
- //$this->_redirect('*/*/document/',array('id'=>$documentId));
301
- }
302
- public function doccompletereadyAction() {
303
- $timetosleed = 2;
304
- sleep($timetosleed);
305
-
306
-
307
- $projectId = $this->getRequest()->getParam('id');
308
- $project = Mage::getModel('textmaster/project');
309
- $project->load($projectId,null,false);
310
- $docs_all = $project->getDocumentsSendToCompleted();
311
- $docs_notcomp = $project->getDocumentsSendNotCompleted();
312
- $ndocc = count($docs_notcomp);
313
-
314
-
315
- if($ndocc!=0) {
316
- $ndoc = count($docs_all);
317
-
318
-
319
- $nd = ($ndoc-$ndocc) / $ndoc;
320
- $r = round($nd,2)*100;
321
- echo $r;
322
- exit;
323
- }
324
- echo $this->getUrl('*/*/view',array('id'=>$projectId));
325
- exit;
326
- }
327
- public function revisionAction() {
328
- $documentId = $this->getRequest()->getParam('id');
329
- $message = $this->getRequest()->getParam('message');
330
- $document = Mage::getModel('textmaster/document')->load($documentId,null,false);
331
- if ($document->getId()){
332
- $documents = $document->revision($message);
333
- }
334
-
335
- $this->_redirect('*/*/document/',array('id'=>$documentId));
336
- }
337
- public function documentAction() {
338
- $docId = $this->getRequest()->getParam('id');
339
- $document = Mage::getModel('textmaster/document')->load($docId,null,true,false);
340
-
341
- if ($document->getId()){
342
- $this->_initAction();
343
- $documentBlock = $this->getLayout()->getBlock('project.document.view');
344
- $documentBlock->setDocument($document);
345
- $supporttBlock = $this->getLayout()->getBlock('project.document.supportmessage');
346
- $supporttBlock->setDocument($document);
347
- $this->renderLayout();
348
- } else {
349
- $this->_redirect('*/*/');
350
- }
351
- }
352
-
353
- public function massLaunchAction() {
354
- $projects = $this->getRequest()->getParam('project_id');
355
- foreach($projects as $project_id){
356
- Mage::getModel('textmaster/project')->load($project_id,null,false)->launch();
357
- }
358
- $this->_redirect('*/*/index');
359
- }
360
- public function massPauseAction() {
361
- $projects = $this->getRequest()->getParam('project_id');
362
- foreach($projects as $project_id){
363
- Mage::getModel('textmaster/project')->load($project_id)->pause();
364
- }
365
- $this->_redirect('*/*/index');
366
- }
367
- public function massResumeAction() {
368
- $projects = $this->getRequest()->getParam('project_id');
369
- foreach($projects as $project_id){
370
- Mage::getModel('textmaster/project')->load($project_id)->resume();
371
- }
372
- $this->_redirect('*/*/index');
373
- }
374
- public function massCancelAction() {
375
- $projects = $this->getRequest()->getParam('project_id');
376
- foreach($projects as $project_id){
377
- Mage::getModel('textmaster/project')->load($project_id)->cancel();
378
- }
379
- $this->_redirect('*/*/index');
380
- }
381
- public function massCompleteAction() {
382
- $projects = $this->getRequest()->getParam('project_id');
383
- foreach($projects as $project_id){
384
- Mage::getModel('textmaster/project')->load($project_id)->complete();
385
- }
386
- $this->_redirect('*/*/index');
387
- }
388
- public function massDuplicateAction(){
389
- $projects = $this->getRequest()->getParam('project_id');
390
- foreach($projects as $project_id){
391
- Mage::getModel('textmaster/project')->load($project_id)->duplicate();
392
- }
393
- $this->_redirect('*/*/index');
394
- }
395
-
396
-
397
- public function createprojectreadyAction(){
398
-
399
- //echo $project->hasDocumentsNotSend()?'0':$this->getUrl('*/*/edit',array('step'=>3));
400
- $timetosleed = 2;
401
- sleep($timetosleed);
402
-
403
- $projectId = $this->getRequest()->getParam('id');
404
- $project = Mage::getModel('textmaster/project');
405
- $project->load($projectId, null, true);
406
- $docs_all = $project->getDocuments();
407
- $docs_notcount = $project->getDocumentsNotCount();
408
-
409
- if($project->hasDocumentsNotCount()) {
410
- $ndoc = count($docs_all);
411
- $ndocc = count($docs_notcount);
412
 
413
- /*
414
- * Ceinture de sécurité : au cas où l'appel à $project->sendDocuments()
415
- * n'ai pas été déjà fait dans le callBack, on le relance ici
416
- * */
417
- $docs_notsend = $project->getDocumentsNotSend();
418
- $ndocs = count($docs_notsend);
419
- if($ndocc==$ndocs)
420
- $project->sendDocuments();
421
-
422
-
423
- $nd = $ndoc-$ndocc;
424
- $nd = $nd / $ndoc;
425
- $r = round($nd,2)*100;
426
- echo $r;
427
- exit;
428
- }
429
 
430
  $project->startTranslationMemory(); // start TM if needed
431
  if($project->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_IN_PROGRESS){
@@ -433,222 +433,224 @@ class Textmaster_Textmaster_Adminhtml_Textmaster_ProjectController extends Mage_
433
  exit;
434
  }
435
 
436
- //echo '100';
437
- echo $this->getUrl('*/*/edit',array('step'=>3));
438
- exit;
439
- }
440
- public function addprojectAction(){
441
- $project_id = Mage::getSingleton('core/session')->getProjectId();
442
- $project = Mage::getModel('textmaster/project');
443
- if($project_id && is_numeric($project_id)){
444
- $project->load($project_id);
445
- }
446
-
447
- $post = Mage::app()->getRequest()->getPost();
448
-
449
-
450
- $this->getResponse()->setHeader('Content-type', 'application/json');
451
- if($post && count($post)){
452
- Mage::getSingleton('core/session')->setProjectInfo($post);
453
- $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
454
- $text = '';
455
- foreach($products_id as $id){
456
- $product = Mage::getModel('catalog/product')->load($id);
457
- if(isset($post['attribute'])) {
458
- foreach($post['attribute'] as $attr){
459
- $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attr);
460
- $text .= $product->getData($attribute->getName ()).' ';
461
- }
462
- }
463
- }
464
- $word_count = Mage::helper('textmaster')->countWord($text);
465
- //$pricing = Mage::helper('textmaster')->getApi()->getPricings($word_count);
466
- //$project_id = Mage::getSingleton('core/session')->getProjectId();
467
 
468
- $update = false;
469
- if($project_id && is_numeric($project_id)){
470
- $project->load($project_id);
471
- $project->setName($post['name']);
472
- $project->setProjectBriefing($post['project_briefing']);
473
- $project->setCtype($post['ctype']);
474
- $project->setCategory($post['category']);
475
- $project->setStoreIdOrigin($post['store_id_origin']);
476
-
477
- if($post['ctype']=='translation')
478
- $project->setStoreIdTranslation($post['store_id_translation']);
479
- else
480
- $project->setStoreIdTranslation($post['store_id_origin']);
481
-
482
- $project->setLanguageLevel($post['language_level']);
483
- if(isset($post['specific_attachment']))
484
- $project->setSpecificAttachment($post['specific_attachment']);
485
- $project->setPriority($post['priority']);
486
- if(!isset($post['quality'])) $post['quality'] = 0;
487
- $project->setQuality($post['quality']);
488
- $project->setExpertise($post['expertise']);
489
- $project->setSameAuthorMustDoEntireProject($post['same_author_must_do_entire_project']);
490
- if(isset($post['ismytextmaster']))
491
- $project->setIsmytextmaster($post['ismytextmaster']);
492
- if(isset($post['mytextmaster'])) {
493
- $project->setTextmasters($post['mytextmaster']);
494
- }
495
  $project->setTranslationMemory($post['translation_memory']);
496
-
497
- $update = true;
498
-
499
- $documents = $project->getDocuments();
500
- $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
501
- foreach($documents as $document){
502
- $document->delete();
503
- }
504
- $project_attributes = $project->getAttributes();
505
- foreach($project_attributes as $project_attribute){
506
- $project_attribute->delete();
507
- }
508
-
509
- } else {
510
- if($post['ctype']!='translation')
511
- $post['store_id_translation'] = $post['store_id_origin'];
512
- $project->setData($post);
513
- }
514
-
515
- try {
516
- $project->save();
517
- if($project->getId()){
518
- Mage::getSingleton('core/session')->setProjectId($project->getId());
519
- if(is_array($post['attribute'])) {
520
- foreach($post['attribute'] as $attr){
521
- $project_attribute = Mage::getModel('textmaster/project_attribute');
522
- $project_attribute->setTextmasterAttributeId($attr);
523
- $project_attribute->setTextmasterProjectId($project->getId());
524
- $project_attribute->save();
525
- }
526
- }
527
- $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
528
-
529
-
530
- $documents = array();
531
- $nbsend = 0;
532
- foreach($products_id as $id){
533
- $product = Mage::getModel('catalog/product')->setStoreId( $project->getStoreIdOrigin() )->load($id);
534
- $document = Mage::getModel('textmaster/document');
535
- $document->setProject($project);
536
- $document->setName($product->getName());
537
- $document->setProductId($id);
538
- $document->setTextmasterProjectId($project->getId());
539
- $document->setSend(0);
540
- $document->save();
541
- $documents[]=$document;
542
- $nbsend++;
543
- }
544
-
545
- $project->sendDocuments();
546
-
547
- $json = Mage::helper('core')->jsonEncode(
548
- array(
549
- 'url'=>$this->getUrl('*/*/edit',array('step'=>3)),
550
- 'counturl' => $this->getUrl('*/*/createprojectready',array('id'=>$project->getId()))
551
-
552
- )
553
- );
554
- $this->getResponse()->setBody($json);
555
- } else {
556
- Mage::getSingleton('core/session')->addError(Mage::helper('textmaster')->__('Project creation error'));
557
- $json = Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/edit',array('step'=>2))));
558
- $this->getResponse()->setBody($json);
559
- }
560
- } catch (Exception $e){
561
- Mage::getSingleton('core/session')->addError($e->getMessage());
562
- $json = Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/edit',array('step'=>2,'reload'=>1))));
563
- $this->getResponse()->setBody($json);
564
- }
565
-
566
- return;
567
- }
568
- $json = Mage::helper('core')->jsonEncode(array('erreur'=>$e->getMessage()));
569
- //throw new Exception('Project creation error');
570
- $this->getResponse()->setBody('NO POST');
571
- }
572
-
573
-
574
-
575
- public function authorAction (){
576
- $this->getResponse()->setHeader('Content-type', 'application/json');
577
- $post = Mage::app()->getRequest()->getPost();
578
- if($post && count($post)==10){
579
- $post['options'] = array(
580
- 'language_level' => $post['language_level'],
581
- //'quality' => $post['quality'],
582
- //'priority' => $post['priority'],
583
- //'expertise' => $post['expertise'],
584
- //'specific_attachment' => $post['specific_attachment'],
585
- );
586
- //$post['total_word_count'] = $post['word_count'];
587
- unset($post['language_level']);
588
- unset($post['quality']);
589
- unset($post['priority']);
590
- unset($post['expertise']);
591
- unset($post['specific_attachment']);
592
- unset($post['form_key']);
593
- unset($post['word_count']);
594
-
595
- $post['language_from'] = substr(Mage::getStoreConfig('general/locale/code',$post['language_from']),0,2);
596
-
597
- if($post['ctype']!='translation') {
598
- unset($post['language_to']);
599
- } else {
600
- $post['language_to'] = substr(Mage::getStoreConfig('general/locale/code',$post['language_to']),0,2);
601
- }
602
- try{
603
- $authors = Mage::helper('textmaster')->getApi()->getAuthorsFilter($post);
604
- if(isset($authors['error'])){
605
- throw new Exception($authors['error']);
606
- }
607
- $result['authors'] = $authors['authors'];
608
-
609
- } catch (Exception $e){
610
- $result['error'] = $e->getMessage();
611
- }
612
-
613
-
614
- } else {
615
- $result['error'] = Mage::helper('textmaster')->__('No post');
616
- }
617
- $json = Mage::helper('core')->jsonEncode($result);
618
- $this->getResponse()->setBody($json);
619
- }
620
-
 
 
 
621
 
622
- public function getmyauthorsAction(){
623
 
624
- $projectId = $this->getRequest()->getParam('id');
625
- $projectModel = Mage::getModel('textmaster/project')->load($projectId);
626
- if ($projectModel->getId()) {
627
- $this->loadLayout();
628
- $d = $projectModel->getData();
629
- $post = Mage::app()->getRequest()->getPost();
630
- if(count($post) && !isset($post['textmasters'])) $post['textmasters']=array();
631
- try{
632
- if($post && count($post) && isset($post['textmasters'])){
633
- if(is_array($post['textmasters'])){
634
- $projectModel->saveTextmasters($post['textmasters']);
635
- } elseif(is_string($post['textmasters'])){
636
- $projectModel->saveTextmasters(array($post['textmasters']));
637
- }
638
-
639
- Mage::getSingleton('adminhtml/session')
640
- ->addSuccess(Mage::helper('textmaster')->__('Textmasters saved'));
641
- }
642
- } catch (Exception $e){
643
- Mage::log(__LINE__.' : '.$e->getMessage(), null, 'textmaster.log');
644
- }
645
- $viewBlock = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step3_form_author');
646
- $viewBlock->setProject($projectModel);
647
- $this->getLayout()->getBlock('step3_author')->setChild('form',$viewBlock);;
648
- $this->renderLayout();
649
- return ;
650
- }
651
- exit;
652
- }
653
- //ster/adminhtml_project/getmyauthors/id/53/key/bed5288e3b1f1d075710db7ab5b6a207/
654
  }
11
  * @category Addonline
12
  * @package Textmaster_Textmaster
13
  * @copyright Copyright (c) 2014 Textmaster
14
+ * @author Addonline (http://www.addonline.fr)
15
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16
  */
17
 
21
  * @category Addonline
22
  * @package Textmaster_Textmaster
23
  * @copyright Copyright (c) 2014 Textmaster
24
+ * @author Addonline (http://www.addonline.fr)
25
  */
26
  class Textmaster_Textmaster_Adminhtml_Textmaster_ProjectController extends Mage_Adminhtml_Controller_Action
27
  {
30
  return Mage::getSingleton('admin/session')->isAllowed('textmaster/projet');
31
  }
32
 
33
+ protected function _initAction() {
34
+ $this->loadLayout()
35
+ ->_setActiveMenu('textmaster/project');
36
+ return $this;
37
+ }
38
+
39
+ public function indexAction()
40
+ {
41
+ $api_key = Mage::getStoreConfig('textmaster/textmaster/api_key');;
42
+ $api_secret = Mage::getStoreConfig('textmaster/textmaster/api_secret');
43
+ $user = Mage::helper('textmaster')->getApi()->getUserInfo();
44
+ if(!isset($user['email'])) {
45
+ $this->_redirect('*/*/login');
46
+ } else {
47
+ $this->_initAction()->renderLayout();
48
+ }
49
+ }
50
+ public function loginAction()
51
+ {
52
+ $this->_initAction()->renderLayout();
53
+ }
54
+
55
+
56
+ public function editAction()
57
+ {
58
+ /*$projectId = $this->getRequest()->getParam('id');
59
+ $projectModel = Mage::getModel('textmaster/project')->load($projectId);*/
60
+
61
+ if (/*$projectModel->getId() || $projectId == 0*/1)
62
+ {
63
+ $step = $this->getRequest()->getParam("step");
64
+
65
+ //Mage::register('project_data', $projectModel);
66
+ //$this->loadLayout();
67
+ $this->_initAction();
68
 
69
+
70
+ $ongletBlock = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets')->assign('step', $step);
71
+ $ongletBlock->setTemplate('textmaster/onglet.phtml');
72
+
73
+ $step1Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step1');
74
+ $step2Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step2');
75
+ $step3Block = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step3');
76
+
77
+ $this->_addContent($ongletBlock);
78
+ switch ($step){
79
+ default:
80
+ case 1:
81
+ $project_id = Mage::getSingleton('core/session')->getProjectId();
82
+ $project = Mage::getModel('textmaster/project');
83
+ if($project_id && is_numeric($project_id)){
84
+ $project->load($project_id);
85
+ $docs = $project->getDocuments();
86
+ $pids = array();
87
+ foreach($docs as $doc){
88
+ $pids[] = $doc->getProductId();
89
+ }
90
+
91
+ $this->getRequest()->setParam('internal_products_id',implode(',',$pids));
92
+
93
+ }
94
+
95
+ $ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven\'t been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation.'));
96
+
97
+
98
+ $this->_addContent($step1Block);
99
+ break;
100
+ case 2:
101
+ $project_id = Mage::getSingleton('core/session')->getProjectId();
102
+ $project = Mage::getModel('textmaster/project');
103
+ if($project_id && is_numeric($project_id)){
104
+ $project->load($project_id);
105
+ $step2Block->setProject($project);
106
+ }
107
+
108
+ $summary = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_summary');
109
+ $ongletBlock->setChild('textmaster.step2',$step2Block);
110
+ $ongletBlock->setChild('textmaster.summary',$summary);
111
+ //$this->_addContent($step2Block);
112
+ $ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)'));
113
+
114
+
115
+ break;
116
+ case 3:
117
+ $project_id = Mage::getSingleton('core/session')->getProjectId();
118
+ $post = Mage::app()->getRequest()->getPost();
119
+ if($post && count($post)){
120
+ $project = Mage::getModel('textmaster/project')->load($project_id, null, false);
121
+ $r = $project->launch();
122
+ if(!isset($r['error'])) {
123
+ $this->_redirect('*/*/');
124
+ } else {
125
+ Mage::getSingleton('adminhtml/session')->addError($r['error']);
126
+ $this->_redirect('*/*/edit', array("step" => 3));
127
+ }
128
+ return ;
129
+ }
130
+ Mage::getSingleton('adminhtml/session')->unsTextmasterUserInfos();
131
+
132
+
133
+ $project = Mage::getModel('textmaster/project')->load($project_id, null, true);
134
+ if($project->hasDocumentsNotCount() || ($project->getTranslationMemory() && $project->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_IN_PROGRESS)){
135
+ $this->_redirect('*/*/edit', array("step" => 2));
136
+ }
137
+ $ongletBlock->setIntroHtml(Mage::helper('textmaster')->__('Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com'));
138
+ $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
139
+ if(empty($products_id)){
140
+ $products_id = array();
141
+ $documents = $project->getDocuments();
142
+ foreach($documents as $document){
143
+ $products_id[] = $document->getProductId();
144
+ }
145
+ Mage::getSingleton('core/session')->setSelectedProducts($products_id);
146
+ }
147
+
148
+ if($project->canLaunch()){
149
+ $ongletBlock->addButton ( 'save', array (
150
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
151
+ 'onclick' => 'editForm.submit();',
152
+ 'class' => 'save',
153
+ ), - 100 );
154
+ } else {
155
+ $ongletBlock->addButton ( 'save', array (
156
+ 'label' => Mage::helper ( 'textmaster' )->__ ( 'Launch' ),
157
+ 'onclick' => 'editForm.submit();',
158
+ 'class' => 'save',
159
+ 'disabled'=>'disabled'
160
+
161
+ ), - 100 );
162
+ }
163
+
164
+ $step3Block->setProject($project);
165
+
166
+ $ongletBlock->insert($step3Block);
167
+
168
+ $this->_addContent($step3Block);
169
+
170
+ break;
171
+ }
172
+
173
+ $this->renderLayout();
174
+ }
175
+ else
176
+ {
177
+ Mage::getSingleton('adminhtml/session')
178
+ ->addError(Mage::helper('textmaster')->__('Project does not exist'));
179
+ $this->_redirect('*/*/');
180
+ }
181
+ }
182
+
183
+ public function newAction()
184
  {
185
+ Mage::getSingleton('core/session')->setSelectedProducts(array());
186
+ Mage::getSingleton('core/session')->setProjectId(0);
187
+ Mage::getSingleton('core/session')->setProjectInfo(array());
188
+ $this->_redirect('*/*/edit');
189
+ }
190
+
191
+ public function massAddAction()
192
+ {
193
+ $products = $this->getRequest()->getParam('products_id');
194
+ if(!is_array($products) || !count($products) || empty($products[0])) {
195
+ $this->_redirect('*/*/edit', array("step" => 1));
196
+ return;
197
+ }
198
+ Mage::getSingleton('core/session')->setSelectedProducts($products);
199
+
200
+
201
+ $this->_redirect('*/*/edit', array("step" => 2));
202
+ }
203
+ public function createprojectfromproductAction(){
204
+ Mage::getSingleton('core/session')->setSelectedProducts(array());
205
+ Mage::getSingleton('core/session')->setProjectId(0);
206
+ Mage::getSingleton('core/session')->setProjectInfo(array());
207
+
208
+ $product = $this->getRequest()->getParam('id');
209
+ Mage::getSingleton('core/session')->setSelectedProducts(array($product));
210
+ $this->_redirect('*/*/edit', array("step" => 2));
211
+ }
212
+
213
+ public function massSendAction()
214
+ {
215
+ $docs = $this->getRequest()->getParam('document_id');
216
+
217
+ //$projectId = $this->getRequest()->getParam('id');
218
+ //Mage::getSingleton('core/session')->setSelectedProducts($products);
219
+ foreach($docs as $doc){
220
+
221
+ Mage::getModel('textmaster/document')->load($doc)->send();
222
+ $projectId = Mage::getModel('textmaster/document')->load($doc)->getTextmasterProjectId();
223
+ }
224
+
225
+ $this->_redirect('*/*/view', array("id" => $projectId));
226
+ }
227
+
228
+ public function viewAction() {
229
+ $projectId = $this->getRequest()->getParam('id');
230
+ $projectModel = Mage::getModel('textmaster/project')->load($projectId);
231
+ if ($projectModel->getId()) {
232
+ if($projectModel->getStatus() == Textmaster_Textmaster_Model_Project::PROJECT_STATUS_IN_CREATION){
233
+ Mage::getSingleton('core/session')->setProjectId($projectModel->getId());
234
+ if(count($projectModel->getDocuments()))
235
+ $this->_redirect('*/*/edit',array('step'=>'3'));
236
+ elseif($projectModel->hasDocumentsNotCount())
237
+ $this->_redirect('*/*/edit',array('step'=>'2'));
238
+ else
239
+ $this->_redirect('*/*/edit',array('step'=>'1'));
240
+ return;
241
+ }
242
+
243
+ //ACTIONS
244
+ $action = $this->getRequest()->getParam('a');
245
+ if($action && is_callable(array($projectModel,$action))){
246
+ call_user_func(array($projectModel,$action));
247
+ }
248
+
249
+ $this->_initAction();
250
+ $viewBlock = $this->getLayout()->getBlock('project.view');
251
+ $viewBlock->setProject($projectModel);
252
+ $viewBlock->prepareButton();
253
+ $documentsBlock = $this->getLayout()->getBlock('project.view.documents');
254
+ $documentsBlock->setProject($projectModel);
255
+
256
+ $this->_addContent($documentsBlock);
257
+
258
+
259
+
260
+ $this->renderLayout();
261
+ } else {
262
+ Mage::getSingleton('adminhtml/session')
263
+ ->addError(Mage::helper('textmaster')->__('Project does not exist'));
264
+ $this->_redirect('*/*/');
265
+ }
266
+ }
267
+ public function masscompletedocAction() {
268
+
269
+ $projectId = $this->getRequest()->getParam('id');
270
+ $project = Mage::getModel('textmaster/project')->load($projectId,null,false);
271
+ $docs = $this->getRequest()->getParam('document_id');
272
+ $doc_api_ids = array();
273
+ foreach($docs as $doc_id){
274
+ $document = Mage::getModel('textmaster/document')->load($doc_id,null,false);
275
+ $document->prepareToComplete();
276
+ $doc_api_ids[]=$document->getDocumentApiId();
277
+ }
278
+
279
+ Mage::helper('textmaster')->getApi()->completeDocuments($project->getProjectApiid(),$doc_api_ids);
280
+ $this->getResponse()->setHeader('Content-type', 'application/json');
281
+ $this->getResponse()->setBody( Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/doccompleteready',array('id'=>$projectId)))));
282
+ //$this->_redirect('*/*/view',array('id'=>$projectId));
283
+ }
284
+ public function doccompleteAction() {
285
+ $documentId = $this->getRequest()->getParam('id');
286
+ $document = Mage::getModel('textmaster/document')->load($documentId,null,false);
287
+ if ($document->getId()){
288
+ $document->sendToComplete();
289
+ $json = Mage::helper('core')->jsonEncode(
290
+ array('counturl' => $this->getUrl('*/*/doccompleteready',array('id'=>$document->getTextmasterProjectId())))
291
+ );
292
+ } else {
293
+ $json = Mage::helper('core')->jsonEncode(
294
+ array()
295
+ );
296
+ }
297
+
298
+ $this->getResponse()->setHeader('Content-type', 'application/json');
299
+ $this->getResponse()->setBody($json);
300
+ //$this->_redirect('*/*/document/',array('id'=>$documentId));
301
+ }
302
+ public function doccompletereadyAction() {
303
+ $timetosleed = 2;
304
+ sleep($timetosleed);
305
+
306
+
307
+ $projectId = $this->getRequest()->getParam('id');
308
+ $project = Mage::getModel('textmaster/project');
309
+ $project->load($projectId,null,false);
310
+ $docs_all = $project->getDocumentsSendToCompleted();
311
+ $docs_notcomp = $project->getDocumentsSendNotCompleted();
312
+ $ndocc = count($docs_notcomp);
313
+
314
+
315
+ if($ndocc!=0) {
316
+ $ndoc = count($docs_all);
317
+
318
+
319
+ $nd = ($ndoc-$ndocc) / $ndoc;
320
+ $r = round($nd,2)*100;
321
+ echo $r;
322
+ exit;
323
+ }
324
+ echo $this->getUrl('*/*/view',array('id'=>$projectId));
325
+ exit;
326
+ }
327
+ public function revisionAction() {
328
+ $documentId = $this->getRequest()->getParam('id');
329
+ $message = $this->getRequest()->getParam('message');
330
+ $document = Mage::getModel('textmaster/document')->load($documentId,null,false);
331
+ if ($document->getId()){
332
+ $documents = $document->revision($message);
333
+ }
334
+
335
+ $this->_redirect('*/*/document/',array('id'=>$documentId));
336
+ }
337
+ public function documentAction() {
338
+ $docId = $this->getRequest()->getParam('id');
339
+ $document = Mage::getModel('textmaster/document')->load($docId,null,true,false);
340
+
341
+ if ($document->getId()){
342
+ $this->_initAction();
343
+ $documentBlock = $this->getLayout()->getBlock('project.document.view');
344
+ $documentBlock->setDocument($document);
345
+ $supporttBlock = $this->getLayout()->getBlock('project.document.supportmessage');
346
+ $supporttBlock->setDocument($document);
347
+ $this->renderLayout();
348
+ } else {
349
+ $this->_redirect('*/*/');
350
+ }
351
+ }
352
+
353
+ public function massLaunchAction() {
354
+ $projects = $this->getRequest()->getParam('project_id');
355
+ foreach($projects as $project_id){
356
+ Mage::getModel('textmaster/project')->load($project_id,null,false)->launch();
357
+ }
358
+ $this->_redirect('*/*/index');
359
+ }
360
+ public function massPauseAction() {
361
+ $projects = $this->getRequest()->getParam('project_id');
362
+ foreach($projects as $project_id){
363
+ Mage::getModel('textmaster/project')->load($project_id)->pause();
364
+ }
365
+ $this->_redirect('*/*/index');
366
+ }
367
+ public function massResumeAction() {
368
+ $projects = $this->getRequest()->getParam('project_id');
369
+ foreach($projects as $project_id){
370
+ Mage::getModel('textmaster/project')->load($project_id)->resume();
371
+ }
372
+ $this->_redirect('*/*/index');
373
+ }
374
+ public function massCancelAction() {
375
+ $projects = $this->getRequest()->getParam('project_id');
376
+ foreach($projects as $project_id){
377
+ Mage::getModel('textmaster/project')->load($project_id)->cancel();
378
+ }
379
+ $this->_redirect('*/*/index');
380
+ }
381
+ public function massCompleteAction() {
382
+ $projects = $this->getRequest()->getParam('project_id');
383
+ foreach($projects as $project_id){
384
+ Mage::getModel('textmaster/project')->load($project_id)->complete();
385
+ }
386
+ $this->_redirect('*/*/index');
387
+ }
388
+ public function massDuplicateAction(){
389
+ $projects = $this->getRequest()->getParam('project_id');
390
+ foreach($projects as $project_id){
391
+ Mage::getModel('textmaster/project')->load($project_id)->duplicate();
392
+ }
393
+ $this->_redirect('*/*/index');
394
+ }
395
+
396
+
397
+ public function createprojectreadyAction(){
398
+
399
+ //echo $project->hasDocumentsNotSend()?'0':$this->getUrl('*/*/edit',array('step'=>3));
400
+ $timetosleed = 2;
401
+ sleep($timetosleed);
402
+
403
+ $projectId = $this->getRequest()->getParam('id');
404
+ $project = Mage::getModel('textmaster/project');
405
+ $project->load($projectId, null, true);
406
+ $docs_all = $project->getDocuments();
407
+ $docs_notcount = $project->getDocumentsNotCount();
408
+
409
+ if($project->hasDocumentsNotCount()) {
410
+ $ndoc = count($docs_all);
411
+ $ndocc = count($docs_notcount);
412
 
413
+ /*
414
+ * Ceinture de sécurité : au cas où l'appel à $project->sendDocuments()
415
+ * n'ai pas été déjà fait dans le callBack, on le relance ici
416
+ * */
417
+ $docs_notsend = $project->getDocumentsNotSend();
418
+ $ndocs = count($docs_notsend);
419
+ if($ndocc==$ndocs)
420
+ $project->sendDocuments();
421
+
422
+
423
+ $nd = $ndoc-$ndocc;
424
+ $nd = $nd / $ndoc;
425
+ $r = round($nd,2)*100;
426
+ echo $r;
427
+ exit;
428
+ }
429
 
430
  $project->startTranslationMemory(); // start TM if needed
431
  if($project->getTranslationMemoryStatus() == Textmaster_Textmaster_Model_Project::PROJECT_TM_STATUS_IN_PROGRESS){
433
  exit;
434
  }
435
 
436
+ //echo '100';
437
+ echo $this->getUrl('*/*/edit',array('step'=>3));
438
+ exit;
439
+ }
440
+ public function addprojectAction(){
441
+ $project_id = Mage::getSingleton('core/session')->getProjectId();
442
+ $project = Mage::getModel('textmaster/project');
443
+ if($project_id && is_numeric($project_id)){
444
+ $project->load($project_id);
445
+ }
446
+
447
+ $post = Mage::app()->getRequest()->getPost();
448
+
449
+ $this->getResponse()->setHeader('Content-type', 'application/json');
450
+ if($post && count($post)){
451
+ Mage::getSingleton('core/session')->setProjectInfo($post);
452
+ $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
453
+ $text = '';
454
+ foreach($products_id as $id){
455
+ $product = Mage::getModel('catalog/product')->load($id);
456
+ if(isset($post['attribute'])) {
457
+ foreach($post['attribute'] as $attr){
458
+ $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attr);
459
+ $text .= $product->getData($attribute->getName ()).' ';
460
+ }
461
+ }
462
+ }
463
+ $word_count = Mage::helper('textmaster')->countWord($text);
464
+ //$pricing = Mage::helper('textmaster')->getApi()->getPricings($word_count);
465
+ //$project_id = Mage::getSingleton('core/session')->getProjectId();
 
466
 
467
+ $update = false;
468
+ if($project_id && is_numeric($project_id)){
469
+ $project->load($project_id);
470
+ $project->setName($post['name']);
471
+ $project->setProjectBriefing($post['project_briefing']);
472
+ $project->setCtype($post['ctype']);
473
+ $project->setCategory($post['category']);
474
+ $project->setStoreIdOrigin($post['store_id_origin']);
475
+
476
+ if($post['ctype']=='translation')
477
+ $project->setStoreIdTranslation($post['store_id_translation']);
478
+ else
479
+ $project->setStoreIdTranslation($post['store_id_origin']);
480
+
481
+ $project->setLanguageLevel($post['language_level']);
482
+ if(isset($post['specific_attachment']))
483
+ $project->setSpecificAttachment($post['specific_attachment']);
484
+ $project->setPriority($post['priority']);
485
+ if(!isset($post['quality'])) $post['quality'] = 0;
486
+ $project->setQuality($post['quality']);
487
+ $project->setExpertise($post['expertise']);
488
+ $project->setSameAuthorMustDoEntireProject($post['same_author_must_do_entire_project']);
489
+ if(isset($post['ismytextmaster']))
490
+ $project->setIsmytextmaster($post['ismytextmaster']);
491
+ if(isset($post['mytextmaster'])) {
492
+ $project->setTextmasters($post['mytextmaster']);
493
+ }
494
  $project->setTranslationMemory($post['translation_memory']);
495
+ if(isset($post['negotiated_contract'])) {
496
+ $project->setNegotiatedContract($post['negotiated_contract']);
497
+ }
498
+
499
+ $update = true;
500
+
501
+ $documents = $project->getDocuments();
502
+ $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
503
+ foreach($documents as $document){
504
+ $document->delete();
505
+ }
506
+ $project_attributes = $project->getAttributes();
507
+ foreach($project_attributes as $project_attribute){
508
+ $project_attribute->delete();
509
+ }
510
+
511
+ } else {
512
+ if($post['ctype']!='translation')
513
+ $post['store_id_translation'] = $post['store_id_origin'];
514
+ $project->setData($post);
515
+ }
516
+
517
+ try {
518
+ $project->save();
519
+ if($project->getId()){
520
+ Mage::getSingleton('core/session')->setProjectId($project->getId());
521
+ if(is_array($post['attribute'])) {
522
+ foreach($post['attribute'] as $attr){
523
+ $project_attribute = Mage::getModel('textmaster/project_attribute');
524
+ $project_attribute->setTextmasterAttributeId($attr);
525
+ $project_attribute->setTextmasterProjectId($project->getId());
526
+ $project_attribute->save();
527
+ }
528
+ }
529
+ $products_id = Mage::getSingleton('core/session')->getSelectedProducts();
530
+
531
+
532
+ $documents = array();
533
+ $nbsend = 0;
534
+ foreach($products_id as $id){
535
+ $product = Mage::getModel('catalog/product')->setStoreId( $project->getStoreIdOrigin() )->load($id);
536
+ $document = Mage::getModel('textmaster/document');
537
+ $document->setProject($project);
538
+ $document->setName($product->getName());
539
+ $document->setProductId($id);
540
+ $document->setTextmasterProjectId($project->getId());
541
+ $document->setSend(0);
542
+ $document->save();
543
+ $documents[]=$document;
544
+ $nbsend++;
545
+ }
546
+
547
+ $project->sendDocuments();
548
+
549
+ $json = Mage::helper('core')->jsonEncode(
550
+ array(
551
+ 'url'=>$this->getUrl('*/*/edit',array('step'=>3)),
552
+ 'counturl' => $this->getUrl('*/*/createprojectready',array('id'=>$project->getId()))
553
+
554
+ )
555
+ );
556
+ $this->getResponse()->setBody($json);
557
+ } else {
558
+ Mage::getSingleton('core/session')->addError(Mage::helper('textmaster')->__('Project creation error'));
559
+ $json = Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/edit',array('step'=>2))));
560
+ $this->getResponse()->setBody($json);
561
+ }
562
+ } catch (Exception $e){
563
+ Mage::getSingleton('core/session')->addError($e->getMessage());
564
+ $json = Mage::helper('core')->jsonEncode(array('url'=>$this->getUrl('*/*/edit',array('step'=>2,'reload'=>1))));
565
+ $this->getResponse()->setBody($json);
566
+ }
567
+
568
+ return;
569
+ }
570
+ $json = Mage::helper('core')->jsonEncode(array('erreur'=>$e->getMessage()));
571
+ //throw new Exception('Project creation error');
572
+ $this->getResponse()->setBody('NO POST');
573
+ }
574
+
575
+
576
+
577
+ public function authorAction (){
578
+ $this->getResponse()->setHeader('Content-type', 'application/json');
579
+ $post = Mage::app()->getRequest()->getPost();
580
+ if($post && count($post)==10){
581
+ $post['options'] = array(
582
+ 'language_level' => $post['language_level'],
583
+ //'quality' => $post['quality'],
584
+ //'priority' => $post['priority'],
585
+ //'expertise' => $post['expertise'],
586
+ //'specific_attachment' => $post['specific_attachment'],
587
+ );
588
+ //$post['total_word_count'] = $post['word_count'];
589
+ unset($post['language_level']);
590
+ unset($post['quality']);
591
+ unset($post['priority']);
592
+ unset($post['expertise']);
593
+ unset($post['specific_attachment']);
594
+ unset($post['form_key']);
595
+ unset($post['word_count']);
596
+
597
+ $post['language_from'] = substr(Mage::getStoreConfig('general/locale/code',$post['language_from']),0,2);
598
+
599
+ if($post['ctype']!='translation') {
600
+ unset($post['language_to']);
601
+ } else {
602
+ $post['language_to'] = substr(Mage::getStoreConfig('general/locale/code',$post['language_to']),0,2);
603
+ }
604
+ try{
605
+ $authors = Mage::helper('textmaster')->getApi()->getAuthorsFilter($post);
606
+ if(isset($authors['error'])){
607
+ throw new Exception($authors['error']);
608
+ }
609
+ $result['authors'] = $authors['authors'];
610
+
611
+ } catch (Exception $e){
612
+ $result['error'] = $e->getMessage();
613
+ }
614
+
615
+
616
+ } else {
617
+ $result['error'] = Mage::helper('textmaster')->__('No post');
618
+ }
619
+ $json = Mage::helper('core')->jsonEncode($result);
620
+ $this->getResponse()->setBody($json);
621
+ }
622
+
623
 
624
+ public function getmyauthorsAction(){
625
 
626
+ $projectId = $this->getRequest()->getParam('id');
627
+ $projectModel = Mage::getModel('textmaster/project')->load($projectId);
628
+ if ($projectModel->getId()) {
629
+ $this->loadLayout();
630
+ $d = $projectModel->getData();
631
+ $post = Mage::app()->getRequest()->getPost();
632
+ if(count($post) && !isset($post['textmasters'])) $post['textmasters']=array();
633
+ try{
634
+ if($post && count($post) && isset($post['textmasters'])){
635
+ if(is_array($post['textmasters'])){
636
+ $projectModel->saveTextmasters($post['textmasters']);
637
+ } elseif(is_string($post['textmasters'])){
638
+ $projectModel->saveTextmasters(array($post['textmasters']));
639
+ }
640
+
641
+ Mage::getSingleton('adminhtml/session')
642
+ ->addSuccess(Mage::helper('textmaster')->__('Textmasters saved'));
643
+ }
644
+ } catch (Exception $e){
645
+ Mage::log(__LINE__.' : '.$e->getMessage(), null, 'textmaster.log');
646
+ }
647
+ $viewBlock = $this->getLayout()->createBlock('textmaster/adminhtml_project_onglets_step3_form_author');
648
+ $viewBlock->setProject($projectModel);
649
+ $this->getLayout()->getBlock('step3_author')->setChild('form',$viewBlock);;
650
+ $this->renderLayout();
651
+ return ;
652
+ }
653
+ exit;
654
+ }
655
+ //ster/adminhtml_project/getmyauthors/id/53/key/bed5288e3b1f1d075710db7ab5b6a207/
656
  }
app/code/community/Textmaster/Textmaster/etc/config.xml CHANGED
@@ -29,7 +29,7 @@
29
 
30
  <modules>
31
  <Textmaster_Textmaster>
32
- <version>1.0.7</version>
33
  </Textmaster_Textmaster>
34
  </modules>
35
  <global>
29
 
30
  <modules>
31
  <Textmaster_Textmaster>
32
+ <version>1.0.8</version>
33
  </Textmaster_Textmaster>
34
  </modules>
35
  <global>
app/code/community/Textmaster/Textmaster/etc/jstranslator.xml CHANGED
@@ -41,4 +41,7 @@
41
  <textmaster_translation_memory translate="message" module="textmaster">
42
  <message>Translation memory</message>
43
  </textmaster_translation_memory>
 
 
 
44
  </jstranslator>
41
  <textmaster_translation_memory translate="message" module="textmaster">
42
  <message>Translation memory</message>
43
  </textmaster_translation_memory>
44
+ <textmaster_negotiated_contract translate="message" module="textmaster">
45
+ <message>Negotiated contract</message>
46
+ </textmaster_negotiated_contract>
47
  </jstranslator>
app/locale/fr_FR/Textmaster_Textmaster.csv CHANGED
@@ -81,7 +81,7 @@ Could not get access token,Impossible de récupérer le token d'accès
81
  Your account has been successfully created.,Votre compte a été créé avec succès.
82
  "Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven't been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation.","Sélectionnez la liste des produits à traduire ou a corriger. Utiliser le filtre dans la dernière colonne pour sélectionner les fiches produits qui n'ont pas encore été traduites. Si la fiche produit a déjà été traduite sur Textmaster, un drapeau apparaît pour chaque traduction effectuée."
83
  "Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)","Définissez les propriétés de votre projet ainsi que le niveau de qualité souhaité et les options à la carte. Enfin, précisez vos instructions au traducteur ou au correcteur (termes spécifiques, instructions de mise en forme, etc.)."
84
- "Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com","Vérifiez les informations de votre projet avant de lancer votre commande. Si votre solde de crédit TextMaster est insuffisant, ciiquez sur le lien ci-deesous pour créditer votre compte sur TextMaster.com"
85
  Project creation error,Erreur lors de la création du projet
86
  No post,Pas de post
87
  Regular,Regular
@@ -202,4 +202,8 @@ Logout,Déconnexion
202
  "Translation memory (+%s/word)","Mémoire de traduction (+%s / mot)"
203
  "Translation memory","Mémoire de traduction"
204
  "Total word count saved", "Nombre total de mots économisés"
205
- "Nb words that you saved:", "Nombre de mots économisés :"
 
 
 
 
81
  Your account has been successfully created.,Votre compte a été créé avec succès.
82
  "Select the list of products to translate or proofread. Use the filter in the last column to select the product descriptions that haven't been translated yet. If the product description has already been translated on TextMaster, a flag will appear beside each completed translation.","Sélectionnez la liste des produits à traduire ou a corriger. Utiliser le filtre dans la dernière colonne pour sélectionner les fiches produits qui n'ont pas encore été traduites. Si la fiche produit a déjà été traduite sur Textmaster, un drapeau apparaît pour chaque traduction effectuée."
83
  "Fill out the project details and choose the service level and extra options. Give translator or proofreader special instructions (specific terms, layout guidelines, etc.)","Définissez les propriétés de votre projet ainsi que le niveau de qualité souhaité et les options à la carte. Enfin, précisez vos instructions au traducteur ou au correcteur (termes spécifiques, instructions de mise en forme, etc.)."
84
+ "Verify your project setting before placing your order. If you do not have enough credits on TextMaster, click on the link below to add credits to your account on TextMaster.com","Vérifiez les informations de votre projet avant de lancer votre commande. Si votre solde de crédit TextMaster est insuffisant, cliquez sur le lien ci-dessous pour créditer votre compte sur TextMaster.com"
85
  Project creation error,Erreur lors de la création du projet
86
  No post,Pas de post
87
  Regular,Regular
202
  "Translation memory (+%s/word)","Mémoire de traduction (+%s / mot)"
203
  "Translation memory","Mémoire de traduction"
204
  "Total word count saved", "Nombre total de mots économisés"
205
+ "Nb words that you saved:", "Nombre de mots économisés :"
206
+ "Negotiated contract (%s/word)","Contract négocié (%s / mot)"
207
+ "Negotiated contract","Contract négocié"
208
+ "Negotiated contracts","Contracts négociés"
209
+ "launched","Lancé"
package.xml CHANGED
@@ -1,20 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Textmaster_Textmaster</name>
4
- <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Get your product descriptions translated or corrected by professionals directly through Magento.</summary>
10
  <description>TextMaster makes it easy to translate (or proofread) your entire product catalog by professionals in over 15 languages. Open your doors to new markets in just a few clicks by using our intuitive extension to make your store multilingual.</description>
11
- <notes>Improved translation memory.&#xD;
12
- Fixed progress bar.&#xD;
13
- Module is compatible with Patch SUPEE-6788.</notes>
14
  <authors><author><name>Textmaster</name><user>Textmaster</user><email>elizaveta@textmaster.com</email></author></authors>
15
- <date>2016-03-14</date>
16
- <time>15:13:09</time>
17
- <contents><target name="magecommunity"><dir name="Textmaster"><dir name="Textmaster"><dir name="Block"><dir name="Adminhtml"><file name="Credit.php" hash="d6a923cfaf5279e4adf27986c87362b0"/><dir name="Document"><dir name="Renderer"><file name="Status.php" hash="f42270298a953c47ed05008dc17ffbe3"/></dir><file name="Supportmessage.php" hash="3de2c98e34072d8036fbb3baf51fc680"/><file name="View.php" hash="431c6abb59610f98030067f2c331619d"/></dir><dir name="Project"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Checkbox.php" hash="8f57ab35ad7704ef05012d219ca0323d"/><file name="Massaction.php" hash="62dadad96a7548df68e3f3c627e94589"/></dir></dir></dir><file name="Grid.php" hash="3a8293430513271d1ee3f44b0c3120f8"/><dir name="Onglets"><file name="Form.php" hash="e686e8cfdac33fa21c86e26fe93a6a07"/><file name="Step1.php" hash="348a7a7bc9004758a517f0939d4ce3bf"/><file name="Step2.php" hash="ba04200c076cbdaeaffead5441176a5e"/><dir name="Step3"><file name="Author.php" hash="7ec92925a374885bfff851d8abf24787"/><dir name="Form"><file name="Author.php" hash="b965e02d28139d9c7f6e58fbb15e8e1b"/></dir></dir><file name="Step3.php" hash="734f10a509563459ccebf12c0f6f17d8"/><file name="Summary.php" hash="ed4dd8dcb8f1acdcc366b405f840570c"/></dir><file name="Onglets.php" hash="309dd49d8d65bf1c71247ce0647ffe20"/><dir name="Renderer"><file name="Nbdocument.php" hash="244d668e3f8a01c21208fdd2a71d0080"/><file name="Price.php" hash="a21b198258a81bb9b411f638e6b5f5e7"/><file name="Progression.php" hash="2e7c43d38b5640b463963a30239225c9"/><file name="Status.php" hash="782007cbd27b4ccc4200e87e34789ee2"/><file name="Store.php" hash="d92ccafcec2ad102b85bcb6bd3131779"/><file name="Wordcount.php" hash="d4714582d744a718e20d5c1444393c8a"/></dir><dir name="View"><file name="Documents.php" hash="48ab17be73308883855cf5ec0d51ce2b"/><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Checkbox.php" hash="89c7d2afed7e6b031237b8d57194aae8"/><file name="Massaction.php" hash="e39a40293de5764fc41c49fa54964026"/></dir></dir></dir></dir><file name="View.php" hash="5843127fdc9d5277e3c35105724ff788"/></dir><file name="Project.php" hash="1919358b2d024822775ec1dbc9f92d2b"/><dir name="Renderer"><file name="Sourcelanguage.php" hash="61ade1d391fc882d3483b68612f1b784"/><file name="Targetlanguage.php" hash="2defedb3f9b57a2c34e05a30533074e1"/><file name="UpdatedAt.php" hash="2543e1ecaf1431966321031d09147c11"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Briefing.php" hash="f1ae93b9d2c02ca12aa93694e070232e"/><file name="Creation.php" hash="598f1f8c60edc5629a7633953c171878"/><file name="Islog.php" hash="9b9527584ab9a2255b293680c7084bb3"/><file name="Login.php" hash="b40da5f18483d89d49ff864a4356cb4b"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="06dda9cf0cf67619895b13e7c1ea80b6"/></dir><dir name="Model"><file name="Api.php" hash="71b60f63f33e564c0481ee794953e67e"/><file name="Document.php" hash="7ed359834dbcf4666e53e7fd5df52ee3"/><dir name="Mysql4"><dir name="Document"><file name="Collection.php" hash="6253cce06c8b2d65305770e4cc0faf34"/></dir><file name="Document.php" hash="b7c143dec4b9c9d131a25fe85e76c686"/><dir name="Project"><dir name="Attribute"><file name="Collection.php" hash="2873221c4cceef621c2920696ca9f937"/></dir><file name="Attribute.php" hash="f997d919bbc5bd47ad840d522ce1de15"/><file name="Collection.php" hash="e804775c9841041a40d03d9ecf9fea8b"/></dir><file name="Project.php" hash="c78db4c76e2ce2f6ebf1cf8a48c723ef"/></dir><file name="Observer.php" hash="2f5778ed0c4fb579ccfd1e3f5c5bcff0"/><dir name="Project"><file name="Attribute.php" hash="e824699895626069cae908b5a7894c4d"/></dir><file name="Project.php" hash="2736605eb17b58a7451b812c024ffaf6"/><dir name="Source"><dir name="Api"><file name="Audience.php" hash="d9bcdf66964436b1efbc96af0a2e2e40"/><file name="Author.php" hash="758fd2e35aa096eacd2995088da64267"/><file name="Category.php" hash="358defa5cf859af62c68f675809b47eb"/><file name="Grammatical.php" hash="dcb73d6ac8cd93f73b6af08ec3ffb057"/><file name="Lang.php" hash="2f7c65d8c9d2247364bab2b3a26cd638"/><file name="Type.php" hash="9cff2f1385ac6e5bafb8c986152c4c08"/><file name="Vocabulary.php" hash="494ed3154a1c8dbe492da5a32f2dbad7"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Textmaster"><file name="AjaxController.php" hash="c256bac1ed6321d433fd5000a31f1533"/><file name="ApiController.php" hash="71e21e3d6db66aecc10ee712d6f83664"/><file name="ProjectController.php" hash="fdb8e99bddb9db4919239fe7b7922cf7"/></dir></dir><file name="CallbackController.php" hash="1cb0d55bb494fa3a354dda2df4124dc2"/><file name="IndexController.php" hash="7588d1f1a9918834837e0215569ab560"/></dir><dir name="etc"><file name="config.xml" hash="f46d69f744397056b03f29edc6f091de"/><file name="jstranslator.xml" hash="dd37ca2fe616ce454a4709e9df300ea9"/><file name="system.xml" hash="ebaaed4b063cef62fb7f6e10655e7adf"/></dir><dir name="sql"><dir name="textmaster_setup"><file name="mysql4-install-0.0.1.php" hash="162032e7872f14cc0049c73b79fdb7e7"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="d0e9ddeb6f62e36747e1f7df4fe99db1"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="8e3cad04b99df0c2a1e3369bd7c432ee"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="1d5f415b61fd5ef6b4c352cd9f2ba75e"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="791ca3e154ba7249478339b98c40eb94"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="865aac8301b8afe668590ec81b08877e"/><file name="mysql4-upgrade-0.0.6-0.0.7.php" hash="22238b586ef7acbfc8e72b60ad19eff2"/><file name="mysql4-upgrade-0.0.7-0.0.8.php" hash="57c692e4a1357794af92e884b7316047"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="e3e41fe7b951b71cc636ad6cc9ce4d2b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="textmaster"><file name="credit.phtml" hash="c89b6836429a831be59d7718c1b6600f"/><dir name="document"><file name="support_messages.phtml" hash="718d4b88147a88dd3a4a79ee937cfb0b"/><file name="view.phtml" hash="3c4164c1c0a8b651f8b799fafd869a00"/></dir><dir name="form"><file name="container.phtml" hash="a178289bb54908698de0423a04f925f3"/></dir><dir name="grid"><file name="container.phtml" hash="3a46640e22f5458ba1bb43abcd50fb31"/></dir><file name="login.phtml" hash="6d32209da30745ee73f9d89e18662792"/><dir name="onglet"><file name="popinauthors.phtml" hash="88755e5187349b78cace1b922a00d310"/></dir><file name="onglet.phtml" hash="694272abc595eebd94f044238bb5d578"/><file name="page.phtml" hash="5dfa6347708268bf5108186a1145e530"/><dir name="product"><file name="edit.phtml" hash="2f2203f3c963fa240f5b47e5c53763a2"/></dir><file name="view.phtml" hash="dde0135f0549c45785974364abc5d842"/></dir></dir><dir name="layout"><file name="textmaster.xml" hash="07d95bbedeeb59386e624e2f78edbee6"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="textmaster"><file name="popin.css" hash="b9624ff6924adf24302b2a9ce73704fb"/><file name="styles.css" hash="61e33a529634ed22fd2e0f56d3647caf"/></dir></dir><dir name="images"><dir name="textmaster"><file name="ad.png" hash="4d3bfa60fb52ee8f9ce3c0f3934a0e08"/><file name="ae.png" hash="f3838d0ca01d7a76de74249ff2b514c7"/><file name="af.png" hash="a44bb210f25bafca92627b1187b0996d"/><file name="ag.png" hash="7b00bd7c2754618d57b78c407d6b542a"/><file name="al.png" hash="3f8b9ccd82877835192c5235e84ea543"/><file name="am.png" hash="f1f48cdf20af82bd4e708f40a844c08e"/><file name="ao.png" hash="13dd9ec64e95578da89ac092ea6bc49d"/><file name="ar.png" hash="e2a2372c9190c58e450d563c857cf932"/><file name="at.png" hash="0ed42d4df345bbe1a9eacc40a1ba9891"/><file name="au.png" hash="95609fc7efb05fab769b08c567dcafe3"/><file name="az.png" hash="82ee424e37625aa0bc6f0f2e2798ff33"/><file name="ba.png" hash="098a79c08cd07a7940affe818d8108d2"/><file name="bb.png" hash="237f1706a74e31a1f0f40080285af716"/><file name="bd.png" hash="5dd17c6db835d0e611b582a9aab36a69"/><file name="be.png" hash="140b16e73953d41b172e5a13106d96d7"/><file name="bf.png" hash="8bf9167bd4d4c8ab177590a03f18cb3a"/><file name="bg.png" hash="5f21946772326567c3bc2eb62693862d"/><file name="bh.png" hash="40acbad63f1ebb842cac8225198caa80"/><file name="bi.png" hash="ef7a1794da922df0876811e673795b40"/><file name="bj.png" hash="e776d8d30d79c46196bf63cf3698a005"/><file name="bn.png" hash="6f8378e8492e6d65297a878000d86cdd"/><file name="bo.png" hash="42addc49c770236532fb3425c39e855e"/><file name="br.png" hash="5820e89cdd217f41a8160611c2772450"/><file name="bs.png" hash="f10c1553ab9d8d3f50fa50789a0ec14d"/><file name="bt.png" hash="edced8a66c05b17cb3a66f4edab81537"/><file name="bw.png" hash="87ad8d31999e9f3dcf4af9b4002bd198"/><file name="by.png" hash="74271a2d533cf0f010f684527506a1b7"/><file name="bz.png" hash="3e6e3a59ea76dd361dd44c59e878cce1"/><file name="ca.png" hash="bde2e7c28a15fef7c21023d0d42e0af6"/><file name="cd.png" hash="43c7041408a403b5a5bff6ee5c486dcb"/><file name="cf.png" hash="8b0f9b4821681f89adc2a05cc9cb93f8"/><file name="cg.png" hash="69fc1655e73b91d5de5e526eb77a25dd"/><file name="ch.png" hash="4bd0882fe41076facbed622f45f5fe12"/><file name="ci.png" hash="33d6b8f53b17b291c82ba89268cc33c3"/><file name="cl.png" hash="97ac63f223ad9b8c9c89ede5a463fe16"/><file name="cm.png" hash="3a02cc8fd12eb3d46785b043eb1b4843"/><file name="cn.png" hash="7d8619cadee5b9bc776bee8c7c0d9bff"/><file name="co.png" hash="01799343910800de170f5bd2842f8610"/><file name="cr.png" hash="a261c45d21511884d98938746a88cda9"/><file name="cu.png" hash="6374430cbe6044d27a1e873982cb0e76"/><file name="cv.png" hash="ad5a8d21169eaa192fed00d022f3e970"/><file name="cy.png" hash="394575dc8ccea26e40ceb8059ed32140"/><file name="cz.png" hash="a25b0e8335083286931938e0b9203176"/><file name="de.png" hash="d5af4cc2395e7221e0fc625f892b44fb"/><file name="dj.png" hash="ad81ed92212c8118daf1227547fa672f"/><file name="dk.png" hash="d4a4b2d8804d713a687690e8d5d86b0d"/><file name="dm.png" hash="3d0dcb98ba84de45ba9f95f829530e75"/><file name="do.png" hash="579619d7a624dd7ee8d01ac1f2128a1e"/><file name="dz.png" hash="d798915a98660a226bb0418c6cf3ef4f"/><file name="ec.png" hash="84126d2520a0d9f993d3237725a7f907"/><file name="ee.png" hash="9d6bb07ed60ff800bb61f5bb0aaad99a"/><file name="eg.png" hash="984c617fe29427198dcbf7d41170e94b"/><file name="eh.png" hash="703d4e948c1f575016157e657d16b4f1"/><file name="en.png" hash="ffdfe557dee5d9f7ff9744708762bf67"/><file name="er.png" hash="847e75043e54c4aa95c219dd05605880"/><file name="es.png" hash="38970876b2bfb01c903419f91f026878"/><file name="et.png" hash="a7838af033c27a4d5d81e5e964dd45f5"/><file name="fi.png" hash="d64cea1ef1a5994aadcc6380bc3f33d6"/><file name="fj.png" hash="5f0f59be9e403329fa7059ab48609118"/><file name="flags-mini.zip" hash="7221658c2d26144a361403723d278205"/><file name="fm.png" hash="437654b1e67bbf1f90e971222fab6974"/><file name="fr.png" hash="6a705fd57e522b3644597d03606d3e17"/><file name="ga.png" hash="619b7bd8cbd79d04949f86b8fef80bc6"/><file name="gd.png" hash="722b7d1192b950ee6d93a02d2a5e4ba7"/><file name="ge.png" hash="930de4a6c9eab9cae548938903500d28"/><file name="gh.png" hash="ad81a6bdafb414b363d08180caf6a8e3"/><file name="gm.png" hash="f16737716084f29a9d9ba01501fb8732"/><file name="gn.png" hash="b36b8a91e876b1d9b11d020c81a2b806"/><file name="gq.png" hash="20bb217c3333a4a0a361581d84ca5326"/><file name="gr.png" hash="2841baa87ea947e5e3bc80278627d5da"/><file name="gt.png" hash="ef388b528291fd6f7742d3b4b0cd3800"/><file name="gw.png" hash="27e732fe984241041a09315ac235a923"/><file name="gy.png" hash="c2083c5428dec76473780cc97f7449a1"/><file name="hn.png" hash="b630fa10ad4fa8762215dc9e716c5466"/><file name="hr.png" hash="e8c7e75fa9eed2ae2b2ba34dd73e56e6"/><file name="ht.png" hash="d125e54a88ac04211b61d49a7fc0cc70"/><file name="hu.png" hash="96db67ede070c6a86a778660d80e7e26"/><file name="id.png" hash="63199df1f7136f80ca81d95190899db7"/><file name="ie.png" hash="d0088733cda1245823726ecf8018ab69"/><file name="il.png" hash="15b6e79abb6f553938b24d949fea1ffd"/><file name="in.png" hash="11addda3b86a7f8fc55abfd80a38f7a5"/><file name="iq.png" hash="35ee00f1ec3e5815ec3890ff397f2ba0"/><file name="ir.png" hash="a0db2ed68e2e29cc366e019e4c676262"/><file name="is.png" hash="1a39e1dec42eb5c8e5cc98bcb6e71c37"/><file name="it.png" hash="502d044737b407caa56138bc8235e55a"/><file name="jm.png" hash="fb67cd9833b430b1081b68d8bea97a4e"/><file name="jo.png" hash="ded495d673605aca3ddb9bd5cc6e2ca3"/><file name="jp.png" hash="64a5be7e6bdc94ba6866bab79b44eabc"/><file name="ke.png" hash="6f58b731e1f6dd7b13cb659e8ff04154"/><file name="kg.png" hash="229cf7889548451a8d467b85d06c212a"/><file name="kh.png" hash="1cd4d9aeaed32e129f54408cb2cda3d7"/><file name="ki.png" hash="b0596385cffbe421730b16f4a2e0d290"/><file name="km.png" hash="657977b976bcbf8c03bcac268814d020"/><file name="kn.png" hash="f89b4a2d2fd0b44e22b4281a7740e4c7"/><file name="kp.png" hash="fd794d0813a3da085113804070ec89e1"/><file name="kr.png" hash="cf0e98be60de5bf10f6dcff1ea224720"/><file name="ks.png" hash="9cb1c058d614957a6c3f04bb8384d672"/><file name="kw.png" hash="2f9130a5d176b54f632f7bb08860f28e"/><file name="kz.png" hash="288a3b09f8dd0b6b251c2a9759ff61e1"/><file name="la.png" hash="07f807a8c739bead3997a11ed6c741b1"/><file name="lb.png" hash="23b9b946942bc2c3ac2242e5675d810f"/><file name="lc.png" hash="2e7aba2fb74c757f79f500dea57fc69c"/><file name="li.png" hash="e826167750c88d94c5eb43c043ba3907"/><file name="lk.png" hash="4463604a10b4b7a3679bd45c76b56dd1"/><file name="lr.png" hash="2cb94086e7fcc2042435c7b69f1e6438"/><file name="ls.png" hash="86bc8c806555483bfa59cfc36d485f66"/><file name="lt.png" hash="35dfa78cf04b6571cc82e7a356641f1b"/><file name="lu.png" hash="329ad84226aacd1e22695cb72c2822cd"/><file name="lv.png" hash="ba99fb872543c7d4853b50f788e2fda0"/><file name="ly.png" hash="1d232daa96e0f7ca7e1ecdec5e6d8371"/><file name="ma.png" hash="006f06311e103a2efb9618f485685300"/><file name="mc.png" hash="6abe8119c30e760986c705c361211fc6"/><file name="md.png" hash="b5904d63976ccfe9985238b76e8b49e0"/><file name="me.png" hash="b7bf90515ff08512425929ff2734f5a5"/><file name="mg.png" hash="896adcfd3afa8f292e25ecaf5e57956e"/><file name="mh.png" hash="50165a2514b035e3482d6d2f4876d8ec"/><file name="mk.png" hash="1016d35de15d82434e06bffda64d421b"/><file name="ml.png" hash="9b3b0773ec50db0f0d775c9776e74c04"/><file name="mm.png" hash="cdafdf2162e5cb1c8b8e312b9f4cfec8"/><file name="mn.png" hash="faa28969f96cae1085cc6c8d9234dbe4"/><file name="mr.png" hash="d83fb1097bcb99133d9d224d06207d71"/><file name="mt.png" hash="ac23976d3a0d2873b7fb72c8503018bf"/><file name="mu.png" hash="bda1ed19036d5716a1aea8ddd23f5b24"/><file name="mv.png" hash="a5e4d4f9d846ba2df572f7855e5d153c"/><file name="mw.png" hash="73ce56eeac955942ab87f6714c2b2f1c"/><file name="mx.png" hash="515daf584560866ba82458a2841b2c5c"/><file name="my.png" hash="ec302b316857c5a655e9d0838a7299bf"/><file name="mz.png" hash="b1a305321450ff8cfacb7b51ef54702e"/><file name="na.png" hash="6b1782b56d5607651fd8467a3282becf"/><file name="ne.png" hash="fd7a4ac6a5b0bfcd11e19b59e4eb9491"/><file name="ng.png" hash="fbdc831cab445407014a8be0cd9d1f9b"/><file name="ni.png" hash="87be5b122aaafed59e42a1c94472f4ca"/><file name="nl.png" hash="b7d65809e5c02d8d36c01a08adc32ee4"/><file name="no.png" hash="87f804f26166303a42d85ceba925ff82"/><file name="np.png" hash="6e43bb94985c756a15b7ad47e1be25a9"/><file name="nr.png" hash="01771f576a6a73750637796ca4f9b1d1"/><file name="nz.png" hash="a37276b951a51d5b4cbf5169b3fbe899"/><file name="om.png" hash="2c13864af6fa36541fc66a6e8f3af91e"/><file name="pa.png" hash="b79104676e49981ca9937015349c63e0"/><file name="pe.png" hash="80a714541ee3a84286f79f31abef7232"/><file name="pg.png" hash="0fd60c1657cf591650ea7672ce1189af"/><file name="ph.png" hash="47942dfa29448f707cc8aea171d120bf"/><file name="pk.png" hash="047cccacc9290dd94a3d5febc0499cf8"/><file name="pl.png" hash="7b8a0298dac0a7f273d5e6b741f8038f"/><file name="pt.png" hash="3141bfbda3235bc2f950243981753a23"/><file name="pw.png" hash="6eaebbe7b69c3bf9c3c50f4c3cc9100f"/><file name="py.png" hash="948dc594390295dc43a22bb228ff8296"/><file name="qa.png" hash="237556d7031c9d09e86e8b806310eef3"/><file name="ro.png" hash="5508a42870fb98d3dc1281133e36908e"/><file name="rs.png" hash="e81f589284efdc070501b676cbf2440a"/><file name="ru.png" hash="46378f0d5a6e8339db251971fa05acc8"/><file name="rw.png" hash="4afb87332945b130e463fc5b7706caf8"/><file name="sa.png" hash="2cf7460d937ea6ac4aa80c84722ff127"/><file name="sb.png" hash="ec4690d32d683027cab5475fbc6817eb"/><file name="sc.png" hash="6b232689798b91d278928c5f8db684b6"/><file name="sd.png" hash="3ec6b86188d06cc95af59a4401fa51c1"/><file name="se.png" hash="34ca8036ec0d98e5b8f0972e7c3b690c"/><file name="sg.png" hash="0df385a93794a40b8927d9b6fe8c8ab4"/><file name="si.png" hash="7c0304b3da174716cb637e559ba30462"/><file name="sk.png" hash="f1192c4beac2189817b990302d6023c0"/><file name="sl.png" hash="dded38a2eedec2575e7200753a8d2c0c"/><file name="sm.png" hash="fce953adb78a308692ae504f8bc68a03"/><file name="sn.png" hash="dee77d596acc5a7045db7c0eca9996e6"/><file name="so.png" hash="a88729fc16aa813315a7edc1374e34e5"/><file name="sr.png" hash="6cd104e7e702c0f17a80be2da797b2c2"/><file name="st.png" hash="ac34029ffd9ab8b0f14669295f838a92"/><file name="sv.png" hash="87de653ebd702dc2c1908bdad6b5e07d"/><file name="sy.png" hash="2c0f028a239914970be87e691bcd3907"/><file name="sz.png" hash="06cf5b39e7ade92fa9d29619f69fa0e6"/><file name="td.png" hash="323ae3550138d0054343f3d75367bfb1"/><file name="tg.png" hash="bf0360afe91efa96d766bc9de7b4726d"/><file name="th.png" hash="7c7f53c225be44fc2897dd007549245b"/><file name="tj.png" hash="472b4679950b9562d3618b9c9ef518d5"/><file name="tl.png" hash="7197fb1849ba9c8c7f9b1e240e37b85b"/><file name="tm.png" hash="177489fdf6e6380131c2f989a1467b24"/><file name="tn.png" hash="162105faa75e6ceb9f0e5b982343a07c"/><file name="to.png" hash="a96505c14820af79abb3567056abca39"/><file name="tr.png" hash="8307e3e68476fe75f0a396b8e96761d3"/><file name="tt.png" hash="304a6848ef200b4d3cde0b1d5cc5523e"/><file name="tv.png" hash="ed5ffe4560b8b651b0d321bc6f6875c7"/><file name="tw.png" hash="56d7df67199ebcce42d70cea202b8a36"/><file name="tz.png" hash="1675509852611fabc2d11966274f5617"/><file name="ua.png" hash="dc3eb73822683ea9980711d34cc01d68"/><file name="ug.png" hash="e7ef297a425c8ac105b5e52c2e338794"/><file name="us.png" hash="1fac8f33d3c11a92fc7913f27df16339"/><file name="uy.png" hash="e00ba3948043a99ab07db91db8dd94f3"/><file name="uz.png" hash="2cb5bc704b35ef438b92824dd1cb7c83"/><file name="va.png" hash="4e3061c712414e91d312ca5a587ea24c"/><file name="vc.png" hash="0ee195323c3613d5e5d635a445c922df"/><file name="ve.png" hash="019c86c82fe6a1ad59ec5d800db3a66f"/><file name="vn.png" hash="d33f6ad2504d1559b10e0f6f084cbe59"/><file name="vu.png" hash="fe3acbd24eb0e11f45cdc3cd6b2a22ea"/><file name="ws.png" hash="bd859467d80a0740bb5ab950def621f2"/><file name="ye.png" hash="47036485a58d485f9cbbc8c661daf8d3"/><file name="za.png" hash="6d0a8ef2e6bdd3325e86b2fe9ec74cf9"/><file name="zm.png" hash="cc14e520271994baccd073ffb852d144"/><file name="zw.png" hash="16b7534269b89084bbdab36c8da5da2e"/></dir></dir><dir name="js"><dir name="textmaster"><file name="script-tmp.js" hash=""/><file name="script.js" hash="5ecaba47717eff63112b70d7c2eaf70a"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Textmaster_Textmaster.xml" hash="c7189ff759aac7e98638198ba1b59e96"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Textmaster_Textmaster.csv" hash="d4b72699394a6fbe182de31ddf97573d"/></dir><dir name="en_US"><file name="Textmaster_Textmaster.csv" hash="1e19327734c2f59fa89882147cc66958"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.2</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Textmaster_Textmaster</name>
4
+ <version>1.0.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/OSL-3.0">Open Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Get your product descriptions translated or corrected by professionals directly through Magento.</summary>
10
  <description>TextMaster makes it easy to translate (or proofread) your entire product catalog by professionals in over 15 languages. Open your doors to new markets in just a few clicks by using our intuitive extension to make your store multilingual.</description>
11
+ <notes>Added new feature : Negotiated contracts&#xD;
12
+ Improved translations</notes>
 
13
  <authors><author><name>Textmaster</name><user>Textmaster</user><email>elizaveta@textmaster.com</email></author></authors>
14
+ <date>2016-07-25</date>
15
+ <time>12:17:31</time>
16
+ <contents><target name="magecommunity"><dir name="Textmaster"><dir name="Textmaster"><dir name="Block"><dir name="Adminhtml"><file name="Credit.php" hash="d6a923cfaf5279e4adf27986c87362b0"/><dir name="Document"><dir name="Renderer"><file name="Status.php" hash="f42270298a953c47ed05008dc17ffbe3"/></dir><file name="Supportmessage.php" hash="3de2c98e34072d8036fbb3baf51fc680"/><file name="View.php" hash="431c6abb59610f98030067f2c331619d"/></dir><dir name="Project"><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Checkbox.php" hash="8f57ab35ad7704ef05012d219ca0323d"/><file name="Massaction.php" hash="62dadad96a7548df68e3f3c627e94589"/></dir></dir></dir><file name="Grid.php" hash="7a4b6de0f9a4e124960449fcd2602dc9"/><dir name="Onglets"><file name="Form.php" hash="e686e8cfdac33fa21c86e26fe93a6a07"/><file name="Step1.php" hash="348a7a7bc9004758a517f0939d4ce3bf"/><file name="Step2.php" hash="c70bcb0521b9b3c58ce112f7c87ff6fe"/><dir name="Step3"><file name="Author.php" hash="7ec92925a374885bfff851d8abf24787"/><dir name="Form"><file name="Author.php" hash="b965e02d28139d9c7f6e58fbb15e8e1b"/></dir></dir><file name="Step3.php" hash="23fabdc54a37e298cbdaf9343ed52cd1"/><file name="Summary.php" hash="7dd65b0110c72180bddd3c9eadfd1f59"/></dir><file name="Onglets.php" hash="309dd49d8d65bf1c71247ce0647ffe20"/><dir name="Renderer"><file name="Nbdocument.php" hash="244d668e3f8a01c21208fdd2a71d0080"/><file name="Price.php" hash="a21b198258a81bb9b411f638e6b5f5e7"/><file name="Progression.php" hash="2e7c43d38b5640b463963a30239225c9"/><file name="Status.php" hash="782007cbd27b4ccc4200e87e34789ee2"/><file name="Store.php" hash="d92ccafcec2ad102b85bcb6bd3131779"/><file name="Wordcount.php" hash="d4714582d744a718e20d5c1444393c8a"/></dir><dir name="View"><file name="Documents.php" hash="48ab17be73308883855cf5ec0d51ce2b"/><dir name="Grid"><dir name="Column"><dir name="Renderer"><file name="Checkbox.php" hash="89c7d2afed7e6b031237b8d57194aae8"/><file name="Massaction.php" hash="e39a40293de5764fc41c49fa54964026"/></dir></dir></dir></dir><file name="View.php" hash="5843127fdc9d5277e3c35105724ff788"/></dir><file name="Project.php" hash="1919358b2d024822775ec1dbc9f92d2b"/><dir name="Renderer"><file name="Sourcelanguage.php" hash="61ade1d391fc882d3483b68612f1b784"/><file name="Targetlanguage.php" hash="2defedb3f9b57a2c34e05a30533074e1"/><file name="UpdatedAt.php" hash="2543e1ecaf1431966321031d09147c11"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Briefing.php" hash="f1ae93b9d2c02ca12aa93694e070232e"/><file name="Creation.php" hash="598f1f8c60edc5629a7633953c171878"/><file name="Islog.php" hash="9b9527584ab9a2255b293680c7084bb3"/><file name="Login.php" hash="b40da5f18483d89d49ff864a4356cb4b"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="17829be4dc0a8b1d0ffd99deb83c0268"/></dir><dir name="Model"><file name="Api.php" hash="1d2b1b60c9d3786b17f35ffab2637be2"/><file name="Document.php" hash="7ed359834dbcf4666e53e7fd5df52ee3"/><dir name="Mysql4"><dir name="Document"><file name="Collection.php" hash="6253cce06c8b2d65305770e4cc0faf34"/></dir><file name="Document.php" hash="b7c143dec4b9c9d131a25fe85e76c686"/><dir name="Project"><dir name="Attribute"><file name="Collection.php" hash="2873221c4cceef621c2920696ca9f937"/></dir><file name="Attribute.php" hash="f997d919bbc5bd47ad840d522ce1de15"/><file name="Collection.php" hash="e804775c9841041a40d03d9ecf9fea8b"/></dir><file name="Project.php" hash="c78db4c76e2ce2f6ebf1cf8a48c723ef"/></dir><file name="Observer.php" hash="2f5778ed0c4fb579ccfd1e3f5c5bcff0"/><dir name="Project"><file name="Attribute.php" hash="e824699895626069cae908b5a7894c4d"/></dir><file name="Project.php" hash="d07f22734da9364f663222e8fbee1ac5"/><dir name="Source"><dir name="Api"><file name="Audience.php" hash="d9bcdf66964436b1efbc96af0a2e2e40"/><file name="Author.php" hash="758fd2e35aa096eacd2995088da64267"/><file name="Category.php" hash="358defa5cf859af62c68f675809b47eb"/><file name="Grammatical.php" hash="dcb73d6ac8cd93f73b6af08ec3ffb057"/><file name="Lang.php" hash="2f7c65d8c9d2247364bab2b3a26cd638"/><file name="Type.php" hash="9cff2f1385ac6e5bafb8c986152c4c08"/><file name="Vocabulary.php" hash="494ed3154a1c8dbe492da5a32f2dbad7"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Textmaster"><file name="AjaxController.php" hash="c256bac1ed6321d433fd5000a31f1533"/><file name="ApiController.php" hash="71e21e3d6db66aecc10ee712d6f83664"/><file name="ProjectController.php" hash="cf4fe24081246587451b21ac5a87f27b"/></dir></dir><file name="CallbackController.php" hash="1cb0d55bb494fa3a354dda2df4124dc2"/><file name="IndexController.php" hash="7588d1f1a9918834837e0215569ab560"/></dir><dir name="etc"><file name="config.xml" hash="89d082c9ee63d97993f80004b03ff2cd"/><file name="jstranslator.xml" hash="e2f46990ac6d5acd8db9a72b27146303"/><file name="system.xml" hash="ebaaed4b063cef62fb7f6e10655e7adf"/></dir><dir name="sql"><dir name="textmaster_setup"><file name="mysql4-install-0.0.1.php" hash="162032e7872f14cc0049c73b79fdb7e7"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="d0e9ddeb6f62e36747e1f7df4fe99db1"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="8e3cad04b99df0c2a1e3369bd7c432ee"/><file name="mysql4-upgrade-0.0.3-0.0.4.php" hash="1d5f415b61fd5ef6b4c352cd9f2ba75e"/><file name="mysql4-upgrade-0.0.4-0.0.5.php" hash="791ca3e154ba7249478339b98c40eb94"/><file name="mysql4-upgrade-0.0.5-0.0.6.php" hash="865aac8301b8afe668590ec81b08877e"/><file name="mysql4-upgrade-0.0.6-0.0.7.php" hash="22238b586ef7acbfc8e72b60ad19eff2"/><file name="mysql4-upgrade-0.0.7-0.0.8.php" hash="57c692e4a1357794af92e884b7316047"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="e3e41fe7b951b71cc636ad6cc9ce4d2b"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="textmaster"><file name="credit.phtml" hash="c89b6836429a831be59d7718c1b6600f"/><dir name="document"><file name="support_messages.phtml" hash="718d4b88147a88dd3a4a79ee937cfb0b"/><file name="view.phtml" hash="3c4164c1c0a8b651f8b799fafd869a00"/></dir><dir name="form"><file name="container.phtml" hash="a178289bb54908698de0423a04f925f3"/></dir><dir name="grid"><file name="container.phtml" hash="3a46640e22f5458ba1bb43abcd50fb31"/></dir><file name="login.phtml" hash="6d32209da30745ee73f9d89e18662792"/><dir name="onglet"><file name="popinauthors.phtml" hash="88755e5187349b78cace1b922a00d310"/></dir><file name="onglet.phtml" hash="694272abc595eebd94f044238bb5d578"/><file name="page.phtml" hash="5dfa6347708268bf5108186a1145e530"/><dir name="product"><file name="edit.phtml" hash="2f2203f3c963fa240f5b47e5c53763a2"/></dir><file name="view.phtml" hash="dde0135f0549c45785974364abc5d842"/></dir></dir><dir name="layout"><file name="textmaster.xml" hash="07d95bbedeeb59386e624e2f78edbee6"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="textmaster"><file name="popin.css" hash="b9624ff6924adf24302b2a9ce73704fb"/><file name="styles.css" hash="61e33a529634ed22fd2e0f56d3647caf"/></dir></dir><dir name="images"><dir name="textmaster"><file name="ad.png" hash="4d3bfa60fb52ee8f9ce3c0f3934a0e08"/><file name="ae.png" hash="f3838d0ca01d7a76de74249ff2b514c7"/><file name="af.png" hash="a44bb210f25bafca92627b1187b0996d"/><file name="ag.png" hash="7b00bd7c2754618d57b78c407d6b542a"/><file name="al.png" hash="3f8b9ccd82877835192c5235e84ea543"/><file name="am.png" hash="f1f48cdf20af82bd4e708f40a844c08e"/><file name="ao.png" hash="13dd9ec64e95578da89ac092ea6bc49d"/><file name="ar.png" hash="e2a2372c9190c58e450d563c857cf932"/><file name="at.png" hash="0ed42d4df345bbe1a9eacc40a1ba9891"/><file name="au.png" hash="95609fc7efb05fab769b08c567dcafe3"/><file name="az.png" hash="82ee424e37625aa0bc6f0f2e2798ff33"/><file name="ba.png" hash="098a79c08cd07a7940affe818d8108d2"/><file name="bb.png" hash="237f1706a74e31a1f0f40080285af716"/><file name="bd.png" hash="5dd17c6db835d0e611b582a9aab36a69"/><file name="be.png" hash="140b16e73953d41b172e5a13106d96d7"/><file name="bf.png" hash="8bf9167bd4d4c8ab177590a03f18cb3a"/><file name="bg.png" hash="5f21946772326567c3bc2eb62693862d"/><file name="bh.png" hash="40acbad63f1ebb842cac8225198caa80"/><file name="bi.png" hash="ef7a1794da922df0876811e673795b40"/><file name="bj.png" hash="e776d8d30d79c46196bf63cf3698a005"/><file name="bn.png" hash="6f8378e8492e6d65297a878000d86cdd"/><file name="bo.png" hash="42addc49c770236532fb3425c39e855e"/><file name="br.png" hash="5820e89cdd217f41a8160611c2772450"/><file name="bs.png" hash="f10c1553ab9d8d3f50fa50789a0ec14d"/><file name="bt.png" hash="edced8a66c05b17cb3a66f4edab81537"/><file name="bw.png" hash="87ad8d31999e9f3dcf4af9b4002bd198"/><file name="by.png" hash="74271a2d533cf0f010f684527506a1b7"/><file name="bz.png" hash="3e6e3a59ea76dd361dd44c59e878cce1"/><file name="ca.png" hash="bde2e7c28a15fef7c21023d0d42e0af6"/><file name="cd.png" hash="43c7041408a403b5a5bff6ee5c486dcb"/><file name="cf.png" hash="8b0f9b4821681f89adc2a05cc9cb93f8"/><file name="cg.png" hash="69fc1655e73b91d5de5e526eb77a25dd"/><file name="ch.png" hash="4bd0882fe41076facbed622f45f5fe12"/><file name="ci.png" hash="33d6b8f53b17b291c82ba89268cc33c3"/><file name="cl.png" hash="97ac63f223ad9b8c9c89ede5a463fe16"/><file name="cm.png" hash="3a02cc8fd12eb3d46785b043eb1b4843"/><file name="cn.png" hash="7d8619cadee5b9bc776bee8c7c0d9bff"/><file name="co.png" hash="01799343910800de170f5bd2842f8610"/><file name="cr.png" hash="a261c45d21511884d98938746a88cda9"/><file name="cu.png" hash="6374430cbe6044d27a1e873982cb0e76"/><file name="cv.png" hash="ad5a8d21169eaa192fed00d022f3e970"/><file name="cy.png" hash="394575dc8ccea26e40ceb8059ed32140"/><file name="cz.png" hash="a25b0e8335083286931938e0b9203176"/><file name="de.png" hash="d5af4cc2395e7221e0fc625f892b44fb"/><file name="dj.png" hash="ad81ed92212c8118daf1227547fa672f"/><file name="dk.png" hash="d4a4b2d8804d713a687690e8d5d86b0d"/><file name="dm.png" hash="3d0dcb98ba84de45ba9f95f829530e75"/><file name="do.png" hash="579619d7a624dd7ee8d01ac1f2128a1e"/><file name="dz.png" hash="d798915a98660a226bb0418c6cf3ef4f"/><file name="ec.png" hash="84126d2520a0d9f993d3237725a7f907"/><file name="ee.png" hash="9d6bb07ed60ff800bb61f5bb0aaad99a"/><file name="eg.png" hash="984c617fe29427198dcbf7d41170e94b"/><file name="eh.png" hash="703d4e948c1f575016157e657d16b4f1"/><file name="en.png" hash="ffdfe557dee5d9f7ff9744708762bf67"/><file name="er.png" hash="847e75043e54c4aa95c219dd05605880"/><file name="es.png" hash="38970876b2bfb01c903419f91f026878"/><file name="et.png" hash="a7838af033c27a4d5d81e5e964dd45f5"/><file name="fi.png" hash="d64cea1ef1a5994aadcc6380bc3f33d6"/><file name="fj.png" hash="5f0f59be9e403329fa7059ab48609118"/><file name="flags-mini.zip" hash="7221658c2d26144a361403723d278205"/><file name="fm.png" hash="437654b1e67bbf1f90e971222fab6974"/><file name="fr.png" hash="6a705fd57e522b3644597d03606d3e17"/><file name="ga.png" hash="619b7bd8cbd79d04949f86b8fef80bc6"/><file name="gd.png" hash="722b7d1192b950ee6d93a02d2a5e4ba7"/><file name="ge.png" hash="930de4a6c9eab9cae548938903500d28"/><file name="gh.png" hash="ad81a6bdafb414b363d08180caf6a8e3"/><file name="gm.png" hash="f16737716084f29a9d9ba01501fb8732"/><file name="gn.png" hash="b36b8a91e876b1d9b11d020c81a2b806"/><file name="gq.png" hash="20bb217c3333a4a0a361581d84ca5326"/><file name="gr.png" hash="2841baa87ea947e5e3bc80278627d5da"/><file name="gt.png" hash="ef388b528291fd6f7742d3b4b0cd3800"/><file name="gw.png" hash="27e732fe984241041a09315ac235a923"/><file name="gy.png" hash="c2083c5428dec76473780cc97f7449a1"/><file name="hn.png" hash="b630fa10ad4fa8762215dc9e716c5466"/><file name="hr.png" hash="e8c7e75fa9eed2ae2b2ba34dd73e56e6"/><file name="ht.png" hash="d125e54a88ac04211b61d49a7fc0cc70"/><file name="hu.png" hash="96db67ede070c6a86a778660d80e7e26"/><file name="id.png" hash="63199df1f7136f80ca81d95190899db7"/><file name="ie.png" hash="d0088733cda1245823726ecf8018ab69"/><file name="il.png" hash="15b6e79abb6f553938b24d949fea1ffd"/><file name="in.png" hash="11addda3b86a7f8fc55abfd80a38f7a5"/><file name="iq.png" hash="35ee00f1ec3e5815ec3890ff397f2ba0"/><file name="ir.png" hash="a0db2ed68e2e29cc366e019e4c676262"/><file name="is.png" hash="1a39e1dec42eb5c8e5cc98bcb6e71c37"/><file name="it.png" hash="502d044737b407caa56138bc8235e55a"/><file name="jm.png" hash="fb67cd9833b430b1081b68d8bea97a4e"/><file name="jo.png" hash="ded495d673605aca3ddb9bd5cc6e2ca3"/><file name="jp.png" hash="64a5be7e6bdc94ba6866bab79b44eabc"/><file name="ke.png" hash="6f58b731e1f6dd7b13cb659e8ff04154"/><file name="kg.png" hash="229cf7889548451a8d467b85d06c212a"/><file name="kh.png" hash="1cd4d9aeaed32e129f54408cb2cda3d7"/><file name="ki.png" hash="b0596385cffbe421730b16f4a2e0d290"/><file name="km.png" hash="657977b976bcbf8c03bcac268814d020"/><file name="kn.png" hash="f89b4a2d2fd0b44e22b4281a7740e4c7"/><file name="kp.png" hash="fd794d0813a3da085113804070ec89e1"/><file name="kr.png" hash="cf0e98be60de5bf10f6dcff1ea224720"/><file name="ks.png" hash="9cb1c058d614957a6c3f04bb8384d672"/><file name="kw.png" hash="2f9130a5d176b54f632f7bb08860f28e"/><file name="kz.png" hash="288a3b09f8dd0b6b251c2a9759ff61e1"/><file name="la.png" hash="07f807a8c739bead3997a11ed6c741b1"/><file name="lb.png" hash="23b9b946942bc2c3ac2242e5675d810f"/><file name="lc.png" hash="2e7aba2fb74c757f79f500dea57fc69c"/><file name="li.png" hash="e826167750c88d94c5eb43c043ba3907"/><file name="lk.png" hash="4463604a10b4b7a3679bd45c76b56dd1"/><file name="lr.png" hash="2cb94086e7fcc2042435c7b69f1e6438"/><file name="ls.png" hash="86bc8c806555483bfa59cfc36d485f66"/><file name="lt.png" hash="35dfa78cf04b6571cc82e7a356641f1b"/><file name="lu.png" hash="329ad84226aacd1e22695cb72c2822cd"/><file name="lv.png" hash="ba99fb872543c7d4853b50f788e2fda0"/><file name="ly.png" hash="1d232daa96e0f7ca7e1ecdec5e6d8371"/><file name="ma.png" hash="006f06311e103a2efb9618f485685300"/><file name="mc.png" hash="6abe8119c30e760986c705c361211fc6"/><file name="md.png" hash="b5904d63976ccfe9985238b76e8b49e0"/><file name="me.png" hash="b7bf90515ff08512425929ff2734f5a5"/><file name="mg.png" hash="896adcfd3afa8f292e25ecaf5e57956e"/><file name="mh.png" hash="50165a2514b035e3482d6d2f4876d8ec"/><file name="mk.png" hash="1016d35de15d82434e06bffda64d421b"/><file name="ml.png" hash="9b3b0773ec50db0f0d775c9776e74c04"/><file name="mm.png" hash="cdafdf2162e5cb1c8b8e312b9f4cfec8"/><file name="mn.png" hash="faa28969f96cae1085cc6c8d9234dbe4"/><file name="mr.png" hash="d83fb1097bcb99133d9d224d06207d71"/><file name="mt.png" hash="ac23976d3a0d2873b7fb72c8503018bf"/><file name="mu.png" hash="bda1ed19036d5716a1aea8ddd23f5b24"/><file name="mv.png" hash="a5e4d4f9d846ba2df572f7855e5d153c"/><file name="mw.png" hash="73ce56eeac955942ab87f6714c2b2f1c"/><file name="mx.png" hash="515daf584560866ba82458a2841b2c5c"/><file name="my.png" hash="ec302b316857c5a655e9d0838a7299bf"/><file name="mz.png" hash="b1a305321450ff8cfacb7b51ef54702e"/><file name="na.png" hash="6b1782b56d5607651fd8467a3282becf"/><file name="ne.png" hash="fd7a4ac6a5b0bfcd11e19b59e4eb9491"/><file name="ng.png" hash="fbdc831cab445407014a8be0cd9d1f9b"/><file name="ni.png" hash="87be5b122aaafed59e42a1c94472f4ca"/><file name="nl.png" hash="b7d65809e5c02d8d36c01a08adc32ee4"/><file name="no.png" hash="87f804f26166303a42d85ceba925ff82"/><file name="np.png" hash="6e43bb94985c756a15b7ad47e1be25a9"/><file name="nr.png" hash="01771f576a6a73750637796ca4f9b1d1"/><file name="nz.png" hash="a37276b951a51d5b4cbf5169b3fbe899"/><file name="om.png" hash="2c13864af6fa36541fc66a6e8f3af91e"/><file name="pa.png" hash="b79104676e49981ca9937015349c63e0"/><file name="pe.png" hash="80a714541ee3a84286f79f31abef7232"/><file name="pg.png" hash="0fd60c1657cf591650ea7672ce1189af"/><file name="ph.png" hash="47942dfa29448f707cc8aea171d120bf"/><file name="pk.png" hash="047cccacc9290dd94a3d5febc0499cf8"/><file name="pl.png" hash="7b8a0298dac0a7f273d5e6b741f8038f"/><file name="pt.png" hash="3141bfbda3235bc2f950243981753a23"/><file name="pw.png" hash="6eaebbe7b69c3bf9c3c50f4c3cc9100f"/><file name="py.png" hash="948dc594390295dc43a22bb228ff8296"/><file name="qa.png" hash="237556d7031c9d09e86e8b806310eef3"/><file name="ro.png" hash="5508a42870fb98d3dc1281133e36908e"/><file name="rs.png" hash="e81f589284efdc070501b676cbf2440a"/><file name="ru.png" hash="46378f0d5a6e8339db251971fa05acc8"/><file name="rw.png" hash="4afb87332945b130e463fc5b7706caf8"/><file name="sa.png" hash="2cf7460d937ea6ac4aa80c84722ff127"/><file name="sb.png" hash="ec4690d32d683027cab5475fbc6817eb"/><file name="sc.png" hash="6b232689798b91d278928c5f8db684b6"/><file name="sd.png" hash="3ec6b86188d06cc95af59a4401fa51c1"/><file name="se.png" hash="34ca8036ec0d98e5b8f0972e7c3b690c"/><file name="sg.png" hash="0df385a93794a40b8927d9b6fe8c8ab4"/><file name="si.png" hash="7c0304b3da174716cb637e559ba30462"/><file name="sk.png" hash="f1192c4beac2189817b990302d6023c0"/><file name="sl.png" hash="dded38a2eedec2575e7200753a8d2c0c"/><file name="sm.png" hash="fce953adb78a308692ae504f8bc68a03"/><file name="sn.png" hash="dee77d596acc5a7045db7c0eca9996e6"/><file name="so.png" hash="a88729fc16aa813315a7edc1374e34e5"/><file name="sr.png" hash="6cd104e7e702c0f17a80be2da797b2c2"/><file name="st.png" hash="ac34029ffd9ab8b0f14669295f838a92"/><file name="sv.png" hash="87de653ebd702dc2c1908bdad6b5e07d"/><file name="sy.png" hash="2c0f028a239914970be87e691bcd3907"/><file name="sz.png" hash="06cf5b39e7ade92fa9d29619f69fa0e6"/><file name="td.png" hash="323ae3550138d0054343f3d75367bfb1"/><file name="tg.png" hash="bf0360afe91efa96d766bc9de7b4726d"/><file name="th.png" hash="7c7f53c225be44fc2897dd007549245b"/><file name="tj.png" hash="472b4679950b9562d3618b9c9ef518d5"/><file name="tl.png" hash="7197fb1849ba9c8c7f9b1e240e37b85b"/><file name="tm.png" hash="177489fdf6e6380131c2f989a1467b24"/><file name="tn.png" hash="162105faa75e6ceb9f0e5b982343a07c"/><file name="to.png" hash="a96505c14820af79abb3567056abca39"/><file name="tr.png" hash="8307e3e68476fe75f0a396b8e96761d3"/><file name="tt.png" hash="304a6848ef200b4d3cde0b1d5cc5523e"/><file name="tv.png" hash="ed5ffe4560b8b651b0d321bc6f6875c7"/><file name="tw.png" hash="56d7df67199ebcce42d70cea202b8a36"/><file name="tz.png" hash="1675509852611fabc2d11966274f5617"/><file name="ua.png" hash="dc3eb73822683ea9980711d34cc01d68"/><file name="ug.png" hash="e7ef297a425c8ac105b5e52c2e338794"/><file name="us.png" hash="1fac8f33d3c11a92fc7913f27df16339"/><file name="uy.png" hash="e00ba3948043a99ab07db91db8dd94f3"/><file name="uz.png" hash="2cb5bc704b35ef438b92824dd1cb7c83"/><file name="va.png" hash="4e3061c712414e91d312ca5a587ea24c"/><file name="vc.png" hash="0ee195323c3613d5e5d635a445c922df"/><file name="ve.png" hash="019c86c82fe6a1ad59ec5d800db3a66f"/><file name="vn.png" hash="d33f6ad2504d1559b10e0f6f084cbe59"/><file name="vu.png" hash="fe3acbd24eb0e11f45cdc3cd6b2a22ea"/><file name="ws.png" hash="bd859467d80a0740bb5ab950def621f2"/><file name="ye.png" hash="47036485a58d485f9cbbc8c661daf8d3"/><file name="za.png" hash="6d0a8ef2e6bdd3325e86b2fe9ec74cf9"/><file name="zm.png" hash="cc14e520271994baccd073ffb852d144"/><file name="zw.png" hash="16b7534269b89084bbdab36c8da5da2e"/></dir></dir><dir name="js"><dir name="textmaster"><file name="script-tmp.js" hash=""/><file name="script.js" hash="ee15fcbfcf7e992e74c87234b4530762"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Textmaster_Textmaster.xml" hash="c7189ff759aac7e98638198ba1b59e96"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Textmaster_Textmaster.csv" hash="e2e468aedc1ff21b1362a78d87fbff09"/></dir><dir name="en_US"><file name="Textmaster_Textmaster.csv" hash="1e19327734c2f59fa89882147cc66958"/></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.3.2</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
skin/adminhtml/default/default/js/textmaster/script.js CHANGED
@@ -142,6 +142,7 @@ jQueryOnLoad = function($){
142
  expertise = $('#expertise').val();
143
  service_level = $('#language_level').val();
144
  translation_memory = $('#translation_memory').val();
 
145
 
146
  $('#textmaster_projet').html($('#ctype option[value='+ctype+']').html());
147
 
@@ -191,6 +192,11 @@ jQueryOnLoad = function($){
191
  if(translation_memory=='1'){
192
  html_option += Translator.translate('Translation memory')+'<br/>';
193
  base_price += translation_memory_price;
 
 
 
 
 
194
  }
195
  /*if(specific_attachment=='1'){
196
  html_option += 'Specific attachment<br/>';
@@ -279,7 +285,7 @@ jQueryOnLoad = function($){
279
 
280
  //updateDisplay();
281
 
282
- $('input[id^=attribute_],#ctype,#specific_attachment,#priority,#quality,#expertise,#language_level,#store_id_translation,#translation_memory').change(function(){
283
  updateDisplay();
284
  });
285
  store_id = $('#store_id_origin').val();
@@ -424,7 +430,6 @@ function documentSend (url){
424
  method: 'get',
425
  onSuccess: function(oXHR) {
426
  if(oXHR.responseText.substr(0,4) != 'http'){
427
- console.log(oXHR.responseText);
428
  if(oXHR.responseText == 'in_progress'){
429
  html = '100% <span class="progress-cadre"><span class="progress" style="width:100%"></span></span>';
430
  html += '<span class="message">'+message_loader_tm+'</span>';
142
  expertise = $('#expertise').val();
143
  service_level = $('#language_level').val();
144
  translation_memory = $('#translation_memory').val();
145
+ negotiated_contract = $('#negotiated_contract').val();
146
 
147
  $('#textmaster_projet').html($('#ctype option[value='+ctype+']').html());
148
 
192
  if(translation_memory=='1'){
193
  html_option += Translator.translate('Translation memory')+'<br/>';
194
  base_price += translation_memory_price;
195
+ }
196
+ negotiated_contract_price = parseFloat(textmaster_negotiated_contract_prices[negotiated_contract]);
197
+ if(negotiated_contract != undefined && negotiated_contract != ''){
198
+ html_option += Translator.translate('Negotiated contract')+'<br/>';
199
+ base_price += negotiated_contract_price;
200
  }
201
  /*if(specific_attachment=='1'){
202
  html_option += 'Specific attachment<br/>';
285
 
286
  //updateDisplay();
287
 
288
+ $('input[id^=attribute_],#ctype,#specific_attachment,#priority,#quality,#expertise,#language_level,#store_id_translation,#translation_memory,#negotiated_contract').change(function(){
289
  updateDisplay();
290
  });
291
  store_id = $('#store_id_origin').val();
430
  method: 'get',
431
  onSuccess: function(oXHR) {
432
  if(oXHR.responseText.substr(0,4) != 'http'){
 
433
  if(oXHR.responseText == 'in_progress'){
434
  html = '100% <span class="progress-cadre"><span class="progress" style="width:100%"></span></span>';
435
  html += '<span class="message">'+message_loader_tm+'</span>';