|
7 | 7 | import android.content.ContentValues; |
8 | 8 | import android.content.Context; |
9 | 9 | import android.content.Intent; |
| 10 | +import android.database.Cursor; |
10 | 11 | import android.os.Bundle; |
11 | 12 | import android.view.Menu; |
12 | 13 | import android.view.MenuInflater; |
@@ -362,13 +363,23 @@ public boolean onOptionsItemSelected(MenuItem item) { |
362 | 363 | private void addItem() { |
363 | 364 | Intent addItemsIntent = new Intent(ClaimActivity.this, AddItems.class); |
364 | 365 | addItemsIntent.putExtra(EXTRA_READONLY, isIntentReadonly()); |
365 | | - ClaimActivity.this.startActivity(addItemsIntent); |
| 366 | + Cursor c = sqlHandler.getMapping("I"); |
| 367 | + if( c != null && c.getCount() == 0){ |
| 368 | + showDialog(getResources().getString(R.string.NoItemsPricelist)); |
| 369 | + }else { |
| 370 | + ClaimActivity.this.startActivity(addItemsIntent); |
| 371 | + } |
366 | 372 | } |
367 | 373 |
|
368 | 374 | private void addService() { |
369 | 375 | Intent addServicesIntent = new Intent(this, AddServices.class); |
370 | 376 | addServicesIntent.putExtra(EXTRA_READONLY, isIntentReadonly()); |
371 | | - ClaimActivity.this.startActivity(addServicesIntent); |
| 377 | + Cursor c = sqlHandler.getMapping("S"); |
| 378 | + if(c != null && c.getCount() == 0){ |
| 379 | + showDialog(getResources().getString(R.string.NoServicesPricelist)); |
| 380 | + }else { |
| 381 | + ClaimActivity.this.startActivity(addServicesIntent); |
| 382 | + } |
372 | 383 | } |
373 | 384 |
|
374 | 385 | @Override |
|
0 commit comments