Salome HOME
Vasily has fixed the following bug : V7_3_0b1
authorrkv <rkv@opencascade.com>
Fri, 29 Nov 2013 09:20:42 +0000 (09:20 +0000)
committerrkv <rkv@opencascade.com>
Fri, 29 Nov 2013 09:20:42 +0000 (09:20 +0000)
(Steps to reproduce)
- Import the e0_donnees.py
- Import the e1_geometrie.py (uses e0_donnees.py)
- Remove the e1_geometrie.py
- Remove the e0_donnees.py
- Import the e0_donnees.py
- Import the e1_geometrie.py (uses e0_donnees.py)
===> It is possible to remove the e0_donnees.py (pop-up menu item is activated)

Workspace/Siman-Common/src/org/splat/service/PublicationServiceImpl.java

index 91f2c25dfed6bd9480aecee19049c3bd33d30640..5439663040c205e4316f2a9ddf9ac79c429ae2d0 100644 (file)
@@ -155,12 +155,9 @@ public class PublicationServiceImpl implements PublicationService {
                        final List<Long> docuses) throws MissedPropertyException,
                        InvalidPropertyException, MultiplyDefinedException, IOException,
                        NotApplicableException, InterruptedException, ParseException {
-               DocumentType type = getDocumentTypeService().selectType(
-                               (int) documentTypeId);
                User user = getUserService().selectUser(userId);
                File updir = getRepositoryService().getDownloadDirectory(user);
                File upfile = new File(updir.getPath() + "/" + fname);
-               String[] table = fname.split("\\x2E");
 
                // Creation of the document
                Document.Properties dprop = new Document.Properties();
@@ -169,6 +166,9 @@ public class PublicationServiceImpl implements PublicationService {
 
                if (reference.length() == 0) { // Importation of a foreign document
                        // TODO: Extract property of supported documents (DOCX, ODT...)
+                       DocumentType type = getDocumentTypeService().selectType(
+                                       (int) documentTypeId);
+                       String[] table = fname.split("\\x2E");
                        addoc = getStepService().createDocument(
                                        step,
                                        dprop.setName(doctitle).setType(type).setFormat(
@@ -210,7 +210,26 @@ public class PublicationServiceImpl implements PublicationService {
                if (docuses != null) {
                        for (Long index : docuses) {
                                Document used = getDocumentService().selectDocument(index);
+                               Publication pub = step.getDocument(index);
+                               if (pub == null) {
+                                   for (Publication doc : step.getOwner().
+                                           getDocums()) {
+                                       if (doc.value().getIndex() == index) {
+                                           pub = doc;
+                                           break;
+                                       }
+                                   }
+                               }
+                               if (pub == null) {
+                                   for (Publication doc : step.getOwnerStudy().getDocums()) {
+                        if (doc.value().getIndex() == index) {
+                            pub = doc;
+                            break;
+                        }
+                    }
+                               }
                                addoc.addDependency(used);
+                               pub.setValue(used);
                        }
                }
                return addoc;