Merge pull request #15487 from frederic34/patch-14

remove header() no more needed
This commit is contained in:
Laurent Destailleur 2020-11-23 21:55:53 +01:00 committed by GitHub
commit 9fbbd18254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 37 deletions

View File

@ -225,8 +225,7 @@ if ($action == 'add')
}
}
}
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer)
{
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->don->supprimer) {
$object->fetch($id);
$result = $object->delete($user);
if ($result > 0) {
@ -237,42 +236,31 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights-
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($action == 'valid_promesse')
{
if ($action == 'valid_promesse') {
$object->fetch($id);
if ($object->valid_promesse($id, $user->id) >= 0)
{
if ($object->valid_promesse($id, $user->id) >= 0) {
setEventMessages($langs->trans("DonationValidated", $object->ref), null);
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($action == 'set_cancel')
{
if ($action == 'set_cancel') {
$object->fetch($id);
if ($object->set_cancel($id) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
if ($object->set_cancel($id) >= 0) {
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($action == 'set_paid')
{
if ($action == 'set_paid') {
$object->fetch($id);
if ($object->set_paid($id, $modepayment) >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
if ($object->set_paid($id, $modepayment) >= 0) {
$action = '';
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'classin' && $user->rights->don->creer)
{
} elseif ($action == 'classin' && $user->rights->don->creer) {
$object->fetch($id);
$object->setProject($projectid);
}

View File

@ -735,8 +735,7 @@ class Don extends CommonObject
{
if ($this->db->affected_rows($resql))
{
if (!$notrigger)
{
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('DON_VALIDATE', $user);
if ($result < 0) { $error++; }
@ -748,8 +747,8 @@ class Don extends CommonObject
$this->error = $this->db->lasterror();
}
if (!$error)
{
if (!$error) {
$this->statut = 1;
$this->db->commit();
return 1;
} else {
@ -777,10 +776,9 @@ class Don extends CommonObject
$sql .= " WHERE rowid = ".$id." AND fk_statut = 1";
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->affected_rows($resql))
{
if ($resql) {
if ($this->db->affected_rows($resql)) {
$this->statut = 2;
return 1;
} else {
return 0;
@ -804,10 +802,9 @@ class Don extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id;
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->affected_rows($resql))
{
if ($resql) {
if ($this->db->affected_rows($resql)) {
$this->statut = -1;
return 1;
} else {
return 0;
@ -828,8 +825,7 @@ class Don extends CommonObject
public function reopen($user, $notrigger = 0)
{
// Protection
if ($this->statut != self::STATUS_CANCELED)
{
if ($this->statut != self::STATUS_CANCELED) {
return 0;
}