Импорт заявок с комментариями

MantisBT forum for users who prefer to ask and answer questions in Russian.

Moderators: Developer, Contributor

alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Импорт заявок с комментариями

Post by alphaed »

На сколько я понял, в стандартом импорте xml (Система импорта/экспорта задач в MantisBT 1.0) нет функционала импорта комментариев.
В то же время есть это
Там вроде как этот функционал добавляется.
Подскажите, данные патчи в силе или с тех пор (2010 год) слишком много воды утекло?
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Импорт заявок с комментариями

Post by Kirill »

Судя по текущему коду в ветке 1.2.x этот функционал включен в рабочую версию.
У Вас возникли ошибки или просто не импортировались комментарии?
alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Re: Импорт заявок с комментариями

Post by alphaed »

Сделал такой xml.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
		<mantis version="1.2.11" urlbase="http://helpdesk.www.ru/" issuelink="#" notelink="~" format="1">
			<issue>
				<id></id>
				<project id="8">fff</project>
				<category id="11">Без категории</category>				
				<reporter id="82">aaa</reporter>
				<handler id="4">bbb</handler>
				<priority id="30">Обычный</priority>
				<severity id="50">малая</severity>
				<reproducibility id="70">не проверялась</reproducibility>
				<status id="90">Закрыт</status>
				<resolution id="20">решен</resolution>
				<projection id="10">нет</projection>
				<profile_id>1</profile_id>
				<view_state id="10">общая</view_state>
				<date_submitted>1301269627</date_submitted>
				<last_updated>1301621615</last_updated>
				<eta id="10">нет</eta>
				<os>Win7</os>
				<os_build>12312.86868</os_build>
				<platform>Some platform v1.0</platform>
				<view_state id="10">общая</view_state>
				<summary>asdfdsfsdfsdfsdf </summary>
				<due_date>1</due_date>
				<description>sdfsdfsfsdfsdfsd</description>
				<steps_to_reproduce><p>нажимаю на кнопку - ничего не происходит</p></steps_to_reproduce>
				<additional_information>fghfhfgf</additional_information>
				<bugnotes>
					<bugnote>
						<reporter_id>294</reporter_id>
						<note>fghfghfgh</note>
						<date_submitted>1301269633</date_submitted>
						<last_modified>1301269633</last_modified>
					</bugnote>
					<bugnote>
						<reporter_id>294</reporter_id>
						<note>fghfhfgh</note>
						<date_submitted>1301269633</date_submitted>
						<last_modified>1301269633</last_modified>
					</bugnote>
				</bugnotes>
			</issue>
Все импортируется кроме каментов
и в файликах /plugins/XmlImportExport/ ничего по поводу каментов нет.

Code: Select all

% grep -r "note" plugins/XmlImportExport/
plugins/XmlImportExport/pages/export.php:$t_bugnote_link = config_get( 'bugnote_link_tag' );
plugins/XmlImportExport/pages/export.php:$writer->writeAttribute( 'notelink', $t_bugnote_link );
plugins/XmlImportExport/ImportXml.php:      public $notelink;
plugins/XmlImportExport/ImportXml.php:      public function get_note_url( $issue_id, $note_id ) {
plugins/XmlImportExport/ImportXml.php:              return $this->urlbase . 'view.php?id=' . $issue_id . '#c' . $note_id;
plugins/XmlImportExport/ImportXml.php:                      $this->source_->notelink = $this->reader_->getAttribute( 'notelink' );
plugins/XmlImportExport/mantis.dtd:           notelink CDATA #REQUIRED
% 
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Импорт заявок с комментариями

Post by Kirill »

А у Вас какая версия Мантиса?
У меня правда ветка 1.3.x
grep -r "note" plugins/XmlImportExport/
plugins/XmlImportExport/pages/export.php:$t_bugnote_link = config_get( 'bugnote_link_tag' );
plugins/XmlImportExport/pages/export.php:$writer->writeAttribute( 'notelink', $t_bugnote_link );
plugins/XmlImportExport/pages/export.php: # fetch and export bugnotes
plugins/XmlImportExport/pages/export.php: $t_bugnotes = bugnote_get_all_bugnotes( $t_row->id );
plugins/XmlImportExport/pages/export.php: if ( is_array( $t_bugnotes ) && count( $t_bugnotes ) > 0 ) {
plugins/XmlImportExport/pages/export.php: $writer->startElement( 'bugnotes' );
plugins/XmlImportExport/pages/export.php: foreach ( $t_bugnotes as $t_bugnote ) {
plugins/XmlImportExport/pages/export.php: $writer->startElement( 'bugnote' );
plugins/XmlImportExport/pages/export.php: $writer->writeElement( 'id', $t_bugnote->id );
plugins/XmlImportExport/pages/export.php: $writer->writeAttribute( 'id', $t_bugnote->reporter_id );
plugins/XmlImportExport/pages/export.php: $writer->text( user_get_name( $t_bugnote->reporter_id ) );
plugins/XmlImportExport/pages/export.php: # bug note
plugins/XmlImportExport/pages/export.php: $writer->writeElement( 'note', $t_bugnote->note );
plugins/XmlImportExport/pages/export.php: $writer->writeAttribute( 'id', $t_bugnote->view_state );
plugins/XmlImportExport/pages/export.php: $writer->text( get_enum_element( 'view_state', $t_bugnote->view_state ) );
plugins/XmlImportExport/pages/export.php: $writer->writeElement( 'date_submitted', $t_bugnote->date_submitted );
plugins/XmlImportExport/pages/export.php: $writer->writeElement( 'last_modified', $t_bugnote->last_modified );
plugins/XmlImportExport/pages/export.php: # note type
plugins/XmlImportExport/pages/export.php: $writer->writeElement( 'note_type', $t_bugnote->note_type );
plugins/XmlImportExport/pages/export.php: # note attr
plugins/XmlImportExport/pages/export.php: $writer->writeElement( 'note_attr', $t_bugnote->note_attr );
plugins/XmlImportExport/pages/export.php: $writer->writeElement( 'time_tracking', $t_bugnote->time_tracking );
plugins/XmlImportExport/pages/export.php: $writer->endElement(); # bugnote
plugins/XmlImportExport/pages/export.php: $writer->endElement(); # bugnotes
plugins/XmlImportExport/pages/export.php: $writer->endElement(); # bugnotes
plugins/XmlImportExport/ImportXml.php: public $notelink;
plugins/XmlImportExport/ImportXml.php: public function get_note_url( $issue_id, $note_id ) {
plugins/XmlImportExport/ImportXml.php: return $this->urlbase . 'view.php?id=' . $issue_id . '#c' . $note_id;
plugins/XmlImportExport/ImportXml.php: $this->source_->notelink = $this->reader_->getAttribute( 'notelink' );
plugins/XmlImportExport/ImportXml.php: // @todo: replace references within bugnotes
plugins/XmlImportExport/mantis.dtd: notelink CDATA #REQUIRED
plugins/XmlImportExport/ImportXml/Issue.php: case 'bugnotes':
plugins/XmlImportExport/ImportXml/Issue.php: // store bug notes
plugins/XmlImportExport/ImportXml/Issue.php: if ($reader->localName == 'bugnote') {
plugins/XmlImportExport/ImportXml/Issue.php: $t_bugnotes[$i]->reporter_id = $this->get_user_id( $reader->value, $userId );
plugins/XmlImportExport/ImportXml/Issue.php: $t_bugnotes[$i]->private = $reader->value == VS_PRIVATE ? true : false;
plugins/XmlImportExport/ImportXml/Issue.php: $t_bugnotes[$i]->$field = $reader->value;
plugins/XmlImportExport/ImportXml/Issue.php: // add bugnotes
plugins/XmlImportExport/ImportXml/Issue.php: if ( $this->new_id_ > 0 && is_array( $t_bugnotes ) && count( $t_bugnotes ) > 0 ) {
plugins/XmlImportExport/ImportXml/Issue.php: foreach ( $t_bugnotes as $t_bugnote) {
plugins/XmlImportExport/ImportXml/Issue.php: bugnote_add( $this->new_id_, $t_bugnote->note, $t_bugnote->time_tracking, $t_bugnote->private, $t_bugnote->note_type, $t_bugnote_>note_attr, $t_bugnote->reporter_id, false, $t_bugnote->date_submitted, $t_bugnote->last_modified, true );
alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Re: Импорт заявок с комментариями

Post by alphaed »

1.2.11
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Импорт заявок с комментариями

Post by Kirill »

Только что проверил в релизе 1.2.11 этого кода нет - как и в ветке 1.2.x.
Видимо этот код появится только в 1.3.0
alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Re: Импорт заявок с комментариями

Post by alphaed »

Так и все таки, этот патч из первого поста в силе?
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Импорт заявок с комментариями

Post by Kirill »

Не уверен.
Надо пробовать. Код между 1.2 и 1.3 сильно отличается.
alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Re: Импорт заявок с комментариями

Post by alphaed »

мдя, самое первое изменение в bug_update.php и сразу мимо.
$t_existing_bug->status вообще такого нет и в bug_update.php всего 227 строк(((

Что делать? Импортить заявки надо с каментами(
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Импорт заявок с комментариями

Post by Kirill »

Пообщался с разработчиками - они не будут портировать эту задачу в 1.2.x - там должны быть только bugfix'ы. Новые разработки типа этой только в новую ветку 1.3.x.

Могу предложить только переход на последний ночной билд, в котором это реализовано. Есть вариант что найдутся какие-нибудь бяки, но по моему опыту, они не настолько критичны и правятся оперативно.
alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Re: Импорт заявок с комментариями

Post by alphaed »

Жестоко, столько времени угробил на настройку, доводку и вылизывание, а банальнейшего функционала нет. Зачем импортить заявки без каментов???
Просто facepalm.
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Импорт заявок с комментариями

Post by Kirill »

no comments
alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Re: Импорт заявок с комментариями

Post by alphaed »

Может есть еще какой плагин или хоть что-то? Не обязательно xml...
Можно конечно непосредственно в базу писать...
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: Импорт заявок с комментариями

Post by Kirill »

Это пока единственный плагин.

Как еще один вариант разверните новую базу и mantisbt 1.3. Импортируйте все данные, а затем перенесите задачи с комментариями с новой базы в рабочую. Или только комментарии.
НО
  1. BACKUP обязателен.
  2. Гарантии работоспособности базы после этого никто не даст :)
alphaed
Posts: 43
Joined: 07 Aug 2012, 09:24

Re: Импорт заявок с комментариями

Post by alphaed »

Забавно, попробую
Post Reply