}
if (count($error_detected) == 0) {
- if (!isset($post['id_adh']) && !$member->isDueFree() && !isset($args['self'])) {
- return $response
- ->withStatus(301)
- ->withHeader(
- 'Location',
- $this->router->pathFor(
- 'contribution',
- [
- 'type' => 'fee',
- 'action' => 'add',
- ]
- ) . '?id_adh=' . $member->id
- );
- } else {
- if (isset($args['self'])) {
- $redirect_url = $this->router->pathFor('login');
- } else {
- $redirect_url = $this->router->pathFor('member', ['id' => $member->id]);
+ $redirect_url = null;
+ if (isset($args['self'])) {
+ $redirect_url = $this->router->pathFor('login');
+ } elseif (isset($post['redirect_on_create'])
+ && $post['redirect_on_create'] > Adherent::AFTER_ADD_DEFAULT
+ ) {
+ switch ($post['redirect_on_create']) {
+ case Adherent::AFTER_ADD_TRANS:
+ $redirect_url = $this->router->pathFor('transaction', ['action' => 'add']);
+ break;
+ case Adherent::AFTER_ADD_NEW:
+ $redirect_url = $this->router->pathFor('editmember', ['action' => 'add']);
+ break;
+ case Adherent::AFTER_ADD_SHOW:
+ $redirect_url = $this->router->pathFor('member', ['id' => $member->id]);
+ break;
+ case Adherent::AFTER_ADD_LIST:
+ $redirect_url = $this->router->pathFor('members');
+ break;
+ case Adherent::AFTER_ADD_HOME:
+ $redirect_url = $this->router->pathFor('slash');
+ break;
}
- return $response
- ->withStatus(301)
- ->withHeader('Location', $redirect_url);
+ } elseif (!isset($post['id_adh']) && !$member->isDueFree()) {
+ $redirect_url = $this->router->pathFor(
+ 'contribution',
+ [
+ 'type' => 'fee',
+ 'action' => 'add',
+ ]
+ ) . '?id_adh=' . $member->id;
+ } else {
+ $redirect_url = $this->router->pathFor('member', ['id' => $member->id]);
}
+
+ return $response
+ ->withStatus(301)
+ ->withHeader('Location', $redirect_url);
} else {
//store entity in session
$this->session->member = $member;
const MAN = 1;
const WOMAN = 2;
+ const AFTER_ADD_DEFAULT = 0;
+ const AFTER_ADD_TRANS = 1;
+ const AFTER_ADD_NEW = 2;
+ const AFTER_ADD_SHOW = 3;
+ const AFTER_ADD_LIST = 4;
+ const AFTER_ADD_HOME = 5;
+
private $_id;
//Identity
private $_title;
{/if}
<p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
<fieldset class="cssform">
- <legend class="ui-state-active ui-corner-top">{if $type eq "fee"}{_T string="Select contributor and membership fee type"}{else}{_T string="Select contributor and donation type"}{/if}</legend>
+ <legend class="ui-state-active ui-corner-top">
+ {if $type eq {_T string="fee" domain="routes"}}
+ {_T string="Select contributor and membership fee type"}
+ <a href="{path_for name="contribution" data=["type" => {_T string="fee" domain="routes"}, "action" => {_T string="add" domain="routes"}]}?trans_id={$transaction->id}" class="button notext fright" id="btnadd" title="{_T string="Create a new fee that will be attached to the current transaction"}">{_T string="New attached fee"}</a>
+ {else}
+ {_T string="Select contributor and donation type"}
+
+ <a href="{path_for name="contribution" data=["type" => {_T string="donation" domain="routes"}, "action" => {_T string="add" domain="routes"}]}?trans_id={$transaction->id}" class="button notext fright" id="btnadddon" title="{_T string="Create a new donation that will be attached to the current transaction"}">{_T string="New attached donation"}</a>
+ {/if}
+
+</legend>
+ <p>
+ {_T string="Create a new %type instead" pattern="/%type/ replace=$type"}
+ </p>
<p>
<label for="id_adh" class="bline">{_T string="Contributor:"}</label>
<select name="id_adh" id="id_adh" class="nochosen"{if isset($disabled.id_adh)} {$disabled.id_adh}{/if}>
{/if}
</div>
<div class="button-container">
+ {if !$member->id && !$self_adh }
+ <label for="redirect_on_create">{_T string="After member creation:"}</label>
+ <select name="redirect_on_create" id="redirect_on_create">
+ <option value="{constant('Galette\Entity\Adherent::AFTER_ADD_DEFAULT')}">{_T string="execute default action"}</option>
+ <option value="{constant('Galette\Entity\Adherent::AFTER_ADD_TRANS')}">{_T string="create a new transaction"}</option>
+ <option value="{constant('Galette\Entity\Adherent::AFTER_ADD_NEW')}">{_T string="create another new member"}</option>
+ <option value="{constant('Galette\Entity\Adherent::AFTER_ADD_SHOW')}">{_T string="show member"}</option>
+ <option value="{constant('Galette\Entity\Adherent::AFTER_ADD_LIST')}">{_T string="go to members list"}</option>
+ <option value="{constant('Galette\Entity\Adherent::AFTER_ADD_HOME')}">{_T string="go to main page"}</option>
+ </select>
+ <br/>
+ {/if}
<button type="submit" name="valid" class="action">
<i class="fas fa-save fa-fw"></i> {_T string="Save"}
</button>
+
{foreach item=entry from=$hidden_elements}
{if $entry->field_id neq 'mdp_adh'}
{assign var="title" value=null}
{/if}
{/if}
{/foreach}
+
<a href="#" id="back2top">{_T string="Back to top"}</a>
</div>
</form>