Commit 56bc4e7e authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Merge branch 'release/v0.9.5'

parents a065f5a2 9d966fe5
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.utc.simde.jessy"
android:versionCode="28"
android:versionName="0.9.4">
android:versionCode="29"
android:versionName="0.9.5">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
......
......@@ -20,6 +20,7 @@ import android.widget.Toast;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -458,11 +459,16 @@ public class ArticleGroupActivity extends BaseActivity {
throw new Exception("Unexpected JSON");
for (JsonNode article : keyboard.get("data").get("items")) {
if (article.has("itm_id")) {
if (article.has("itm_id") && article.has("name")) {
boolean in = false;
for (JsonNode articleInList : articleList) {
if (articleInList.get("id").intValue() == article.get("itm_id").intValue()) {
articlesForThisKeyboard.add(articleInList);
JsonNode articleToAdd = new ObjectMapper().readTree(articleInList.toString());
if (!article.get("name").textValue().isEmpty())
((ObjectNode) articleToAdd).put("name", article.get("name").textValue());
articlesForThisKeyboard.add(articleToAdd);
in = true;
break;
}
......
......@@ -101,6 +101,11 @@ public class BuyerInfoActivity extends BaseActivity {
public void onItemClick(AdapterView parent, View view, int position, long id) {
final JsonNode article = lastArticleList.get(position);
if (listAdapater.getArticle(position).has("canceled") && listAdapater.getArticle(position).get("canceled").booleanValue()) {
dialog.infoDialog(BuyerInfoActivity.this, getString(R.string.cancel_transaction), getString(R.string.already_canceled));
return;
}
final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(BuyerInfoActivity.this);
alertDialogBuilder
.setTitle(R.string.cancel_transaction)
......@@ -238,7 +243,6 @@ public class BuyerInfoActivity extends BaseActivity {
}
final ArrayNode articleList = new ObjectMapper().createArrayNode();
Boolean hasRight = true; //
try {
for (JsonNode purchase : lastPurchaseList) {
......@@ -250,7 +254,9 @@ public class BuyerInfoActivity extends BaseActivity {
ObjectNode toAdd = (ObjectNode) new ObjectMapper().readTree(article.toString());
toAdd.put("info", getString(R.string.realized) + " " + purchase.get("pur_date").textValue().substring(purchase.get("pur_date").textValue().length() - 8));
toAdd.put("quantity", Math.round(purchase.get("pur_qte").floatValue()));
toAdd.put("price", purchase.get("pur_unit_price").intValue());
toAdd.put("purchase_id", purchase.get("pur_id").intValue());
toAdd.put("canceled", purchase.get("pur_removed").booleanValue());
articleList.add(toAdd);
isIn = true;
......@@ -265,6 +271,7 @@ public class BuyerInfoActivity extends BaseActivity {
"\"quantity\":" + Math.round(purchase.get("pur_qte").floatValue()) + ", " +
"\"purchase_id\":" + purchase.get("pur_id").intValue() + ", " +
"\"info\":\"" + getString(R.string.realized_by_other) + "\", " +
"\"canceled\":\"" + Boolean.toString(purchase.get("pur_removed").booleanValue()) + "\", " +
"\"image_url\":\"\"}"
));
}
......
......@@ -3,6 +3,7 @@ package fr.utc.simde.jessy.adapters;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -48,8 +49,8 @@ public class ListAdapater extends ArticlesAdapter {
ImageView imageCotisant = this.viewList[position].findViewById(R.id.image_cotisant);
ImageView image18 = this.viewList[position].findViewById(R.id.image_18);
if (article.has("info")) {
TextView infoText = this.viewList[position].findViewById(R.id.text_info);
if (article.has("info")) {
infoText.setText(article.get("info").textValue());
imageCotisant.setVisibility(View.GONE);
......@@ -60,8 +61,14 @@ public class ListAdapater extends ArticlesAdapter {
setImage(imageView, article.get("image_url").textValue(), position);
if (article.has("quantity")) {
if (article.has("quantity"))
nbrClicksList[position] = article.get("quantity").intValue();
if (article.has("canceled") && article.get("canceled").booleanValue()) {
nameText.setPaintFlags(nameText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
priceText.setPaintFlags(nameText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
infoText.setPaintFlags(nameText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
clickViewList[position].setPaintFlags(nameText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
}
if (this.nbrClicksList[position] < 0)
......
......@@ -70,5 +70,4 @@
android:textStyle="italic"
android:text="@string/app_not_connected" />
</LinearLayout>
</RelativeLayout>
......@@ -139,6 +139,7 @@
<string name="app_configurated">L\'application a été configurée par défaut sur ce mode d\'affichage. Seul une personne possédant les droits peut reconfigurer l\'application par défaut</string>
<string name="can_cancel">Permettre l\'annulation</string>
<string name="can_sell">Permettre la vente</string>
<string name="already_canceled">La transaction a déjà été annulée</string>
<string name="cant_cancel">L\'application a été configurée pour ne pas permettre l\'annulation d\'une transaction (contacter un adminstrateur pour annuler)</string>
<string name="read_card_information">Informations de la carte</string>
<string name="add_new_card">Ajouter</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