Commit d4d431ef authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Merge branch 'master' into ripley

parents 7d4b0d16 6f255a70
Loading
Loading
Loading
Loading
Loading
+6 −17
Original line number Diff line number Diff line
@@ -211,8 +211,10 @@
      </article>
    </section>
    <section v-else>
      <span class="cartouche" v-for="e in stacked" :class="e.hasPrimary ? 'primary' : 'default' ">
        {{ e.enrolledLabel }}
      <span class="cartouche" v-for="e in stacked" :class="{
        'primary': e.hasPrimary, 'default': !e.hasPrimary}">
        <a :href="e.urlShow" v-if="e.urlShow">{{ e.enrolledLabel }}</a>
        <span v-else>{{ e.enrolledLabel }}</span>
        <span class="addon principal" >
          <span v-for="r in e.roles" class="addon-module" :class="{'primary': r.rolePrincipal}">
            {{ r.role }}
@@ -220,20 +222,6 @@
        </span>
      </span>
    </section>

<!--
    <span class="cartouche" v-for="e in entities" :class="{'primary': e.rolePrincipal, 'outofdate past': e.past }">
      <i v-if="e.context == 'activity'" class="icon-cube"></i>
      <i v-else class="icon-cubes"></i>
      <span class="text-clickable" @click="open(e.urlShow)" v-if="e.urlShow">{{ e.enrolledLabel }}</span>
      <span v-else>{{ e.enrolledLabel }}</span>
      <span class="addon">
        {{ e.roleLabel }}
        <i class="icon-pencil-1 icon-clickable" v-if="manage" @click="handlerEdit(e)"></i>
        <i class="icon-trash icon-clickable" v-if="manage" @click="handlerDelete(e)"></i>
      </span>
    </span>
-->
  </div>
</template>
<script>
@@ -288,6 +276,7 @@ export default {
        if( !stacks.hasOwnProperty(id) ){
          stacks[id] = {
            enrolled: i.enrolled,
            urlShow: i.urlShow,
            enrolledLabel: i.enrolledLabel,
            hasPrimary: false
          }
@@ -378,7 +367,7 @@ export default {
      this.$http.post(url, data).then(ok => {

      }, ko => {
        this.error = "Erreur : " + ko.body;
        this.error = "Erreur : Impossible de modifier le rôle : " + ko.body;
      }).then(foo => {
        this.loading = false;
        this.fetch();
+1 −1
Original line number Diff line number Diff line
@@ -456,7 +456,7 @@ class EnrollController extends AbstractOscarController implements UsePersonServi
                $dateStart,
                $dateEnd
            );
            return $this->getResponseOk("La personne a bien été ajouté");
            return $this->getResponseOk("L'organisation a bien été ajoutée");
        } catch (\Exception $e) {
            $msg = "Impossible d'ajouter l'organisation à l'activité : " . $e->getMessage();
            $this->getLoggerService()->error("$msg : " . $e->getMessage());
+17 −7
Original line number Diff line number Diff line
@@ -2343,7 +2343,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
         * @var ActivityOrganization $activityOrganization
         */
        foreach ($activity->getOrganizationsDeep() as $activityOrganization) {
            // FIX (non idéale)

            // Cas particulier (affectation sans rôle)
            // rôle supprimé ? manipulation extérieur
            if (!$activityOrganization->getRoleObj()) {
                $this->getLoggerService()->warning(
                    sprintf(
@@ -2352,8 +2354,17 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                        $activityOrganization->getEnroller()
                    )
                );
                continue;
                $roleId = 0;
                $roleprincipal = false;
                $rolelabel = "Rôle inconnu";
                $role = null;
            } else {
                $roleId = $activityOrganization->getRoleObj()->getId();
                $roleprincipal = $activityOrganization->getRoleObj()->isPrincipal();
                $rolelabel = $activityOrganization->getRoleObj()->getRoleId();
                $role = $activityOrganization->getRoleObj();
            }

            $class = get_class($activityOrganization);

            if ($class == ActivityOrganization::class) {
@@ -2385,10 +2396,10 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif

            $out[] = [
                'id' => $activityOrganization->getId(),
                'roleId' => $activityOrganization->getRoleObj()->getId(),
                'role' => $activityOrganization->getRole(),
                'roleLabel' => $activityOrganization->getRole(),
                'rolePrincipal' => $activityOrganization->isPrincipal(),
                'roleId' => $roleId,
                'role' => $role,
                'roleLabel' => $rolelabel,
                'rolePrincipal' => $roleprincipal,
                'urlDelete' => $urlDelete,
                'context' => $context,
                'contextKey' => $contextKey,
@@ -2398,7 +2409,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                'enrollerLabel' => (string)$activity,
                'editable' => $editable,
                'deletable' => $deletable,
//                'hash' => (string)$activityOrganization,
                'enrolled' => $activityOrganization->getOrganization()->getId(),
                'enrolledLabel' => $activityOrganization->getOrganization()->getFullName(),
                'past' => !$activityOrganization->isActive(),
+1 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ class ProjectGrantForm extends Form implements InputFilterProviderInterface, Use
        $this->add([
            'name' => 'codeEOTP',
            'options' => [
                'label' => 'EOTP'
                'label' => 'N°Financier (' . $this->getProjectGrantService()->getOscarConfigurationService()->getFinancialLabel() . ')'
            ],
            'attributes' => [
                'class' => 'form-control'
+14 −2
Original line number Diff line number Diff line
@@ -71,6 +71,10 @@ class EnrollToArrayFormatter
        if( $this->oscarUserContext->hasPrivileges($manageEnrollPrivilege, $affectation->getEnroller()) ){
            $output['urlEdit'] = $this->url->fromRoute($this->getConf($affectation)->edit, ['idenroll' => $affectation->getId()]);
            $output['urlDelete'] = $this->url->fromRoute($this->getConf($affectation)->delete, ['idenroll' => $affectation->getId()]);
            $output['urlShow'] = false;
            if( $this->oscarUserContext->hasPrivileges($showEnrolledPrivilege) ){
                $output['urlShow'] = $this->url->fromRoute($this->getConf($affectation)->urlEnrolledShow, ['id' => $affectation->getEnrolled()->getId()]);
            }
        }

        $output['manage'] = $manage;
@@ -91,27 +95,35 @@ class EnrollToArrayFormatter
                $_conf->context = self::CONTEXT_PROJECT;
                $_conf->manage = Privileges::PROJECT_ORGANIZATION_MANAGE;
                $_conf->show = Privileges::PROJECT_ORGANIZATION_SHOW;
                $_conf->showEnrolled = Privileges::ORGANIZATION_SHOW;
                $_conf->urlEnrolledShow = 'organization/show';
                $_conf->edit = 'organizationproject/edit';
                $_conf->delete = 'organizationproject/delete';
                break;
            case ProjectMember::class :
                $_conf->context = self::CONTEXT_PROJECT;
                $_conf->manage = Privileges::PROJECT_PERSON_MANAGE;
                $_conf->showEnrolled = Privileges::PERSON_SHOW;
                $_conf->show = Privileges::PROJECT_PERSON_SHOW;
                $_conf->urlEnrolledShow = 'person/show';
                $_conf->edit = 'personproject/edit';
                $_conf->delete = 'personproject/delete';
                break;
            case ActivityOrganization::class:
                $_conf->context = self::CONTEXT_ACTIVITY;
                $_conf->manage = Privileges::ACTIVITY_ORGANIZATION_MANAGE;
                $_conf->showEnrolled = Privileges::ORGANIZATION_SHOW;
                $_conf->show = Privileges::ACTIVITY_ORGANIZATION_SHOW;
                $_conf->urlEnrolledShow = 'organization/show';
                $_conf->edit = 'organizationactivity/edit';
                $_conf->delete = 'organizationactivity/delete';
                break;
            case ActivityPerson::class :
                $_conf->context = self::CONTEXT_ACTIVITY;
                $_conf->manage = Privileges::ACTIVITY_PERSON_MANAGE;
                $_conf->show = Privileges::ACTIVITY_PAYMENT_SHOW;
                $_conf->showEnrolled = Privileges::PERSON_SHOW;
                $_conf->show = Privileges::ACTIVITY_PERSON_SHOW;
                $_conf->urlEnrolledShow = 'person/show';
                $_conf->edit = 'personactivity/edit';
                $_conf->delete = 'personactivity/delete';
                break;
@@ -132,7 +144,7 @@ class EnrollToArrayFormatter
    }

    protected function getShowEnrolledPrivilege($affectation){
        return $this->getConf($affectation)->show;
        return $this->getConf($affectation)->showEnrolled;
    }

    protected function getContext($affectation) :string {
Loading