Skip to content
Snippets Groups Projects
Commit 3f51dd76 authored by srosse's avatar srosse
Browse files

OO-3425: in the publish process, delete the offer and not the offer access as...

OO-3425: in the publish process, delete the offer and not the offer access as in the access configuration panel
parent da4dd4fa
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ import java.util.List; ...@@ -23,6 +23,7 @@ import java.util.List;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryEntryAllowToLeaveOptions; import org.olat.repository.RepositoryEntryAllowToLeaveOptions;
import org.olat.resource.accesscontrol.Offer;
import org.olat.resource.accesscontrol.OfferAccess; import org.olat.resource.accesscontrol.OfferAccess;
/** /**
* *
...@@ -40,7 +41,7 @@ public class CourseAccessAndProperties { ...@@ -40,7 +41,7 @@ public class CourseAccessAndProperties {
private Boolean confirmationEmail; private Boolean confirmationEmail;
private List<OfferAccess> offerAccess; private List<OfferAccess> offerAccess;
private List<OfferAccess> deletedOfferAccess; private List<Offer> deletedOffer;
public CourseAccessAndProperties(RepositoryEntry re) { public CourseAccessAndProperties(RepositoryEntry re) {
this.repoEntry = re; this.repoEntry = re;
...@@ -65,12 +66,12 @@ public class CourseAccessAndProperties { ...@@ -65,12 +66,12 @@ public class CourseAccessAndProperties {
this.offerAccess = offerAccess; this.offerAccess = offerAccess;
} }
public List<OfferAccess> getDeletedOfferAccess() { public List<Offer> getDeletedOffer() {
return deletedOfferAccess; return deletedOffer;
} }
public void setDeletedOfferAccess(List<OfferAccess> deletedOfferAccess) { public void setDeletedOffer(List<Offer> deletedOffer) {
this.deletedOfferAccess = deletedOfferAccess; this.deletedOffer = deletedOffer;
} }
public RepositoryEntry getRepositoryEntry() { public RepositoryEntry getRepositoryEntry() {
......
...@@ -732,9 +732,9 @@ public class PublishProcess { ...@@ -732,9 +732,9 @@ public class PublishProcess {
acService.saveOfferAccess(newLink); acService.saveOfferAccess(newLink);
} }
// 2: remove offerings not available anymore // 2: remove offerings not available anymore
List<OfferAccess> deletedOfferAccess = accessAndProps.getDeletedOfferAccess(); List<Offer> deletedOffers = accessAndProps.getDeletedOffer();
for (OfferAccess deletedLink : deletedOfferAccess) { for (Offer deletedOffer : deletedOffers) {
acService.deletedLinkToMethod(deletedLink); acService.deleteOffer(deletedOffer);
} }
MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish"); MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish");
......
...@@ -110,7 +110,7 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -110,7 +110,7 @@ public class PublishStep01AccessForm extends StepFormBasicController {
private MultipleSelectionElement confirmationEmailEl; private MultipleSelectionElement confirmationEmailEl;
private List<FormLink> addMethods = new ArrayList<>(); private List<FormLink> addMethods = new ArrayList<>();
private List<OfferAccess> offerAccess = new ArrayList<>(); private List<OfferAccess> offerAccess = new ArrayList<>();
private List<OfferAccess> deletedOfferAccess = new ArrayList<>(); private List<Offer> deletedOffer = new ArrayList<>();
private final String displayName; private final String displayName;
private CloseableModalController cmc; private CloseableModalController cmc;
...@@ -119,7 +119,7 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -119,7 +119,7 @@ public class PublishStep01AccessForm extends StepFormBasicController {
private final List<AccessInfo> confControllers = new ArrayList<>(); private final List<AccessInfo> confControllers = new ArrayList<>();
private int button_id; private int buttonId;
private final boolean emptyConfigGrantsFullAccess; private final boolean emptyConfigGrantsFullAccess;
private boolean allowPaymentMethod; private boolean allowPaymentMethod;
private final boolean editable; private final boolean editable;
...@@ -147,7 +147,7 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -147,7 +147,7 @@ public class PublishStep01AccessForm extends StepFormBasicController {
displayName = entry.getDisplayname(); displayName = entry.getDisplayname();
resource = entry.getOlatResource(); resource = entry.getOlatResource();
emptyConfigGrantsFullAccess = true; emptyConfigGrantsFullAccess = true;
button_id = 0; buttonId = 0;
editable = !RepositoryEntryManagedFlag.isManaged(entry, RepositoryEntryManagedFlag.bookings); editable = !RepositoryEntryManagedFlag.isManaged(entry, RepositoryEntryManagedFlag.bookings);
formatter = Formatter.getInstance(getLocale()); formatter = Formatter.getInstance(getLocale());
...@@ -173,7 +173,7 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -173,7 +173,7 @@ public class PublishStep01AccessForm extends StepFormBasicController {
canCopy.isSelected(0), canReference.isSelected(0), canDownload.isSelected(0)); canCopy.isSelected(0), canReference.isSelected(0), canDownload.isSelected(0));
accessProperties.setOfferAccess(offerAccess); accessProperties.setOfferAccess(offerAccess);
accessProperties.setDeletedOfferAccess(deletedOfferAccess); accessProperties.setDeletedOffer(deletedOffer);
if(confirmationEmailEl.isVisible()) { if(confirmationEmailEl.isVisible()) {
accessProperties.setConfirmationEmail(confirmationEmailEl.isAtLeastSelected(1)); accessProperties.setConfirmationEmail(confirmationEmailEl.isAtLeastSelected(1));
} else { } else {
...@@ -349,7 +349,7 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -349,7 +349,7 @@ public class PublishStep01AccessForm extends StepFormBasicController {
for(Offer offer:offers) { for(Offer offer:offers) {
List<OfferAccess> offerAccessList = acService.getOfferAccess(offer, true); List<OfferAccess> offerAccessList = acService.getOfferAccess(offer, true);
for(OfferAccess access:offerAccessList) { for(OfferAccess access:offerAccessList) {
button_id++; buttonId++;
addConfiguration(access); addConfiguration(access);
} }
} }
...@@ -358,7 +358,7 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -358,7 +358,7 @@ public class PublishStep01AccessForm extends StepFormBasicController {
protected void addConfiguration(OfferAccess link) { protected void addConfiguration(OfferAccess link) {
AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType()); AccessMethodHandler methodHandler = acModule.getAccessMethodHandler(link.getMethod().getType());
AccessInfo infos = new AccessInfo(methodHandler.getMethodName(getLocale()), methodHandler.isPaymentMethod(), null, link); AccessInfo infos = new AccessInfo(methodHandler.getMethodName(getLocale()), methodHandler.isPaymentMethod(), null, link);
infos.setButtonId(button_id); infos.setButtonId(buttonId);
confControllers.add(infos); confControllers.add(infos);
if(editable) { if(editable) {
...@@ -546,8 +546,8 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -546,8 +546,8 @@ public class PublishStep01AccessForm extends StepFormBasicController {
AccessInfo infos = (AccessInfo)source.getUserObject(); AccessInfo infos = (AccessInfo)source.getUserObject();
OfferAccess deleteOffer = infos.getLink(); OfferAccess deleteOffer = infos.getLink();
offerAccess.remove(deleteOffer); offerAccess.remove(deleteOffer);
if (deleteOffer.getKey() != null) { if (deleteOffer.getKey() != null && deleteOffer.getOffer() != null && deleteOffer.getOffer().getKey() != null) {
deletedOfferAccess.add(deleteOffer); deletedOffer.add(deleteOffer.getOffer());
} }
confControllers.remove(infos); confControllers.remove(infos);
updateConfirmationEmail(); updateConfirmationEmail();
...@@ -564,7 +564,7 @@ public class PublishStep01AccessForm extends StepFormBasicController { ...@@ -564,7 +564,7 @@ public class PublishStep01AccessForm extends StepFormBasicController {
if(newMethodCtrl == source) { if(newMethodCtrl == source) {
if(event.equals(Event.DONE_EVENT)) { if(event.equals(Event.DONE_EVENT)) {
OfferAccess newLink = newMethodCtrl.commitChanges(); OfferAccess newLink = newMethodCtrl.commitChanges();
button_id++; buttonId++;
if (!offerAccess.contains(newLink)) { if (!offerAccess.contains(newLink)) {
offerAccess.add(newLink); offerAccess.add(newLink);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment