LSrelation : Add create button even if user can't edit the relation
authorBenjamin Renard <brenard@easter-eggs.com>
Wed, 2 Aug 2017 10:09:25 +0000 (12:09 +0200)
committerBenjamin Renard <brenard@easter-eggs.com>
Wed, 2 Aug 2017 10:09:25 +0000 (12:09 +0200)
public_html/includes/class/class.LSrelation.php

index 6930350..88169d8 100644 (file)
@@ -254,21 +254,22 @@ class LSrelation {
             'objectDn' => $object -> getDn(),
           );
           $relation = new LSrelation($object, $relationName);
+
           if ($relation -> canEdit()) {
             $return['actions'][] = array(
               'label' => _('Modify'),
               'url' => 'select.php?LSobject='.$relationConf['LSobject'].'&amp;multiple=1'.($relation -> getRelatedEditableAttribute()?'&amp;editableAttr='.$relation -> getRelatedEditableAttribute():''),
               'action' => 'modify'
             );
-            if ($relation -> canCreate()) {
-               $return['actions'][] = array(
-                'label' => _('New'),
-                'url' => 'create.php?LSobject='.$relationConf['LSobject'].'&amp;LSrelation='.$relationName.'&amp;relatedLSobject='.$object->getType().'&amp;relatedLSobjectDN='.urlencode($object -> getValue('dn')),
-                'action' => 'create'
-              );
-            }
           }
-          
+          if ($relation -> canCreate()) {
+             $return['actions'][] = array(
+              'label' => _('New'),
+              'url' => 'create.php?LSobject='.$relationConf['LSobject'].'&amp;LSrelation='.$relationName.'&amp;relatedLSobject='.$object->getType().'&amp;relatedLSobjectDN='.urlencode($object -> getValue('dn')),
+              'action' => 'create'
+            );
+          }
+
           $list = $relation -> listRelatedObjects();
           if (is_array($list)) {
             foreach($list as $o) {