Commit 005cf41f authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Merge branch 'hotfix/locationbug' into develop

parents 0076a51e 963b13bc
......@@ -78,7 +78,12 @@ public class ArticleGroupActivity extends BaseActivity {
}
if (this.nbrGroups == 0) {
dialog.errorDialog(this, getResources().getString(R.string.information_collection), getResources().getString(R.string.article_error_0_categorie_not_0), new DialogInterface.OnClickListener() {
if (config.getLocationId() != -1) {
config.setLocation(-1, "");
config.setCanCancel(true);
}
dialog.errorDialog(this, getResources().getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(R.string.article_error_0), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int id) {
finish();
......@@ -444,16 +449,11 @@ public class ArticleGroupActivity extends BaseActivity {
for (JsonNode keyboard : keyboardList) {
ArrayNode articlesForThisKeyboard = new ObjectMapper().createArrayNode();
if (!keyboard.has("id") || !keyboard.has("name") || !keyboard.has("fun_id") || keyboard.get("fun_id").intValue() != foundationId || !keyboard.has("data") || !keyboard.get("data").has("items") || !keyboard.get("data").get("items").isArray() || !keyboard.get("data").has("nbColumns"))
throw new Exception("Unexpected JSON");
if (config.getFoundationId() != -1) if (!authorizedList.contains(keyboard.get("id").intValue()))
continue;
else if (articlesForThisKeyboard.size() == 0)
continue;
if (articlesForThisKeyboard == null)
continue;
if (!keyboard.has("id") || !keyboard.has("name") || !keyboard.has("fun_id") || keyboard.get("fun_id").intValue() != foundationId || !keyboard.has("data") || !keyboard.get("data").has("items") || !keyboard.get("data").get("items").isArray() || !keyboard.get("data").has("nbColumns"))
throw new Exception("Unexpected JSON");
for (JsonNode article : keyboard.get("data").get("items")) {
if (article.has("itm_id")) {
......@@ -473,6 +473,9 @@ public class ArticleGroupActivity extends BaseActivity {
articlesForThisKeyboard.add(new ObjectMapper().createObjectNode());
}
if (articlesForThisKeyboard.size() == 0)
continue;
createNewGroup(keyboard.get("name").textValue(), articlesForThisKeyboard, keyboard.get("data").get("nbColumns").isInt() ? keyboard.get("data").get("nbColumns").intValue() : Integer.valueOf(keyboard.get("data").get("nbColumns").textValue()));
}
}
......
......@@ -258,55 +258,99 @@ public abstract class BaseActivity extends NFCActivity {
runOnUiThread(new Runnable() {
@Override
public void run() {
fatal(activity, getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting), e.getMessage());
fatal(activity, getString(R.string.location_list_collecting), e.getMessage());
}
});
}
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.changeLoading(getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting));
}
});
if (config.getLocationId() != -1 || config.getInCategory()) {
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.changeLoading(getString(R.string.category_list_collecting));
}
});
try {
if (config.getInCategory())
try {
nemopaySession.getCategories();
else
nemopaySession.getKeyboards();
Thread.sleep(100);
Thread.sleep(100);
// Toute une série de vérifications avant de lancer l'activité
final HTTPRequest request = nemopaySession.getRequest();
final JsonNode groupList = request.getJSONResponse();
// Toute une série de vérifications avant de lancer l'activité
final HTTPRequest request = nemopaySession.getRequest();
final JsonNode groupList = request.getJSONResponse();
if (!groupList.isArray())
throw new Exception("Malformed JSON");
if (!groupList.isArray())
throw new Exception("Malformed JSON");
if (config.getLocationId() == -1 && groupList.size() == 0) {
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.stopLoading();
dialog.errorDialog(activity, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(R.string.category_error_0));
}
});
return;
}
intent.putExtra("categoryList", request.getResponse());
} catch (final Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage());
if (groupList.size() == 0) {
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.stopLoading();
dialog.errorDialog(activity, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(config.getInCategory() ? R.string.category_error_0 : R.string.keyboard_error_0));
fatal(activity, getString(R.string.category_list_collecting), e.getMessage());
}
});
return;
}
}
intent.putExtra(config.getInCategory() ? "categoryList" : "keyboardList", request.getResponse());
} catch (final Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage());
if (config.getLocationId() != -1 || !config.getInCategory()) {
runOnUiThread(new Runnable() {
@Override
public void run() {
fatal(activity, getString(config.getInCategory() ? R.string.category_list_collecting : R.string.keyboard_list_collecting), e.getMessage());
dialog.changeLoading(getString(R.string.keyboard_list_collecting));
}
});
try {
nemopaySession.getKeyboards();
Thread.sleep(100);
// Toute une série de vérifications avant de lancer l'activité
final HTTPRequest request = nemopaySession.getRequest();
final JsonNode groupList = request.getJSONResponse();
if (!groupList.isArray())
throw new Exception("Malformed JSON");
if (config.getLocationId() == -1 && groupList.size() == 0) {
runOnUiThread(new Runnable() {
@Override
public void run() {
dialog.stopLoading();
dialog.errorDialog(activity, getString(R.string.information_collection), nemopaySession.getFoundationName() + " " + getString(R.string.keyboard_error_0));
}
});
return;
}
intent.putExtra("keyboardList", request.getResponse());
} catch (final Exception e) {
Log.e(LOG_TAG, "error: " + e.getMessage());
runOnUiThread(new Runnable() {
@Override
public void run() {
fatal(activity, getString(R.string.keyboard_list_collecting), e.getMessage());
}
});
}
}
runOnUiThread(new Runnable() {
......
......@@ -114,14 +114,18 @@ public class FoundationsOptionsActivity extends BaseActivity {
if (isOption(position,0))
dialog.infoDialog(FoundationsOptionsActivity.this, "Non encore fait", "Pour la version 0.9");
else if (isOption(position,1))
dialog.infoDialog(FoundationsOptionsActivity.this, "Non encore fait", "Pour la version 0.9");
dialog.infoDialog(FoundationsOptionsActivity.this, "Non encore fait", "Pour la version 0.11");
else if (isOption(position,2))
dialog.infoDialog(FoundationsOptionsActivity.this, "Non encore fait", "Pour la version 0.12");
else if (isOption(position,1))
dialog.infoDialog(FoundationsOptionsActivity.this, "Non encore fait", "Pour la version 0.12");
else if (isOption(position,2))
dialog.infoDialog(FoundationsOptionsActivity.this, "Non encore fait", "Pour la version 0.10");
else if (isOption(position,3))
else if (isOption(position,5))
startCardManagementActivity(FoundationsOptionsActivity.this);
else if (isOption(position,4))
else if (isOption(position,6))
keyNemopayDialog();
else if (isOption(position,5))
else if (isOption(position,7))
keyGingerDialog();
else
configDialog();
......
......@@ -3,6 +3,8 @@
<string-array name="options">
<item>Mode annulation</item>
<item>Modifier les articles</item>
<item>Effectuer un rechargement</item>
<item>Effectuer un transfert</item>
<item>Lire un QR Code</item>
<item>Gestion des cartes/cotisations</item>
<item>Modifier la clé Nemopay</item>
......
......@@ -115,7 +115,6 @@
<string name="keyboard_error_0">n\'a aucun clavier de caisse</string>
<string name="category_error_0">n\'a aucune catégorie</string>
<string name="article_error_0">n\'a aucun article à vendre</string>
<string name="article_error_0_categorie_not_0">Toutes les catégories sont vides</string>
<string name="buyer_info_collecting">Récupération des informations de la personne</string>
<string name="user_searching">Identification de la personne</string>
<string name="user_nemopay_info_collecting">Identification de la personne auprès de Nemopay</string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment