Fix: #3229 [Members] Cancelling member type creation yields weird bug

This commit is contained in:
aspangaro 2015-07-17 06:11:06 +02:00
parent e62595b00f
commit fb0f50cf4b

View File

@ -34,8 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("members");
$rowid = GETPOST('rowid','int');
$action = GETPOST('action','alpha');
$rowid = GETPOST('rowid','int');
$action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha');
$search_lastname = GETPOST('search_lastname','alpha');
$search_login = GETPOST('search_login','alpha');
@ -85,7 +86,7 @@ $hookmanager->initHooks(array('membertypecard','globalcard'));
*/
if ($action == 'add' && $user->rights->adherent->configurer)
{
if ($_POST["button"] != $langs->trans("Cancel"))
if (! $cancel)
{
$object = new AdherentType($db);
@ -123,7 +124,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
if ($action == 'update' && $user->rights->adherent->configurer)
{
if ($_POST["button"] != $langs->trans("Cancel"))
if (! $cancel)
{
$object = new AdherentType($db);
$object->id = $rowid;
@ -152,14 +153,6 @@ if ($action == 'delete' && $user->rights->adherent->configurer)
exit;
}
if ($action == 'commentaire' && $user->rights->adherent->configurer)
{
$don = new Don($db);
$don->fetch($rowid);
$don->update_note(dol_html_entity_decode(GETPOST('commentaire'), ENT_QUOTES));
}
/*
* View
*/
@ -291,7 +284,7 @@ if ($action == 'create')
print '<div class="center">';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Add").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
print '</div>';
print "</form>\n";