Skip to content

Commit

Permalink
fix converting from text to list bug
Browse files Browse the repository at this point in the history
  • Loading branch information
WajdyEssam committed Aug 11, 2012
1 parent 797eb8b commit 71553d5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
7 changes: 6 additions & 1 deletion MangoDatabase/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ namespace Database {

QStringList Helper::fromTextToList(QString text)
{
return text.split(",");
QStringList tmp;

if ( !text.isEmpty() )
tmp = text.split(",");

return tmp;
}

QString Helper::fromListToText(QStringList ids)
Expand Down
2 changes: 1 addition & 1 deletion MangoReports/ordersdetailsreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ OrdersDetailsReport::OrdersDetailsReport(const QDateTime& from, const QDateTime&
QString OrdersDetailsReport::getHTML()
{
QString orignalHTML = getTemplateFileContent();
orignalHTML = orignalHTML.replace("%DETAIL_REPORT_TYPE%", "Orders Details Report");
orignalHTML = orignalHTML.replace("%DETAIL_REPORT_TYPE%", "تقرير بتفاصيل الطلبات");
orignalHTML = orignalHTML.replace("%DETAIL_TABLE%", getTableData());

return orignalHTML;
Expand Down
7 changes: 6 additions & 1 deletion MangoService/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ namespace Services {

QStringList Helper::fromTextToList(QString text)
{
return text.split(",");
QStringList tmp;

if ( !text.isEmpty() )
tmp = text.split(",");

return tmp;
}

QString Helper::fromListToText(QStringList ids)
Expand Down
9 changes: 5 additions & 4 deletions MangoService/orderdetail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "component.h"
#include "itemdetail.h"
#include "itemcomponent.h"
#include <QDebug>

namespace Services {

Expand Down Expand Up @@ -46,16 +47,16 @@ QList<Model::OrderDetail> OrderDetail::getByOrderId(int orderId)

QList<Model::Component> components;
foreach (Model::Component c, i->components()) {
c = Services::Component::getById(c.id());
components.append(c);
Model::Component tmp = Services::Component::getById(c.id());
components.append(tmp);
}

i->setComponent(components);

QList<Model::Additional> additional;
foreach (Model::Additional a, i->additionals()) {
a = Services::Additional::getById(a.id());
additional.append(a);
Model::Additional tmp = Services::Additional::getById(a.id());
additional.append(tmp);
}

i->setAdditionals(additional);
Expand Down

0 comments on commit 71553d5

Please sign in to comment.