mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 17:02:34 +01:00
NEW Add status canceled on direct debit payment
This commit is contained in:
@@ -183,6 +183,14 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setcancel' && $permissiontocreditdebit) {
|
||||
$savtype = $object->type;
|
||||
$res = $object->setStatut(BonPrelevement::STATUS_CANCELED);
|
||||
if ($res <= 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $permissiontodelete) {
|
||||
$savtype = $object->type;
|
||||
$res = $object->delete($user);
|
||||
@@ -436,6 +444,16 @@ if ($id > 0 || $ref) {
|
||||
}
|
||||
}
|
||||
|
||||
if (getDolGlobalString('BANK_CAN_REOPEN_DIRECT_DEBIT_OR_CREDIT_TRANSFER')) {
|
||||
if ($object->status == BonPrelevement::STATUS_DEBITED || $object->status == BonPrelevement::STATUS_CREDITED) {
|
||||
if ($object->type == 'bank-transfer') {
|
||||
print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit'));
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'credit'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->status == BonPrelevement::STATUS_TRANSFERED) {
|
||||
if ($object->type == 'bank-transfer') {
|
||||
print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit'));
|
||||
@@ -444,13 +462,12 @@ if ($id > 0 || $ref) {
|
||||
}
|
||||
}
|
||||
|
||||
if (getDolGlobalString('BANK_CAN_REOPEN_DIRECT_DEBIT_OR_CREDIT_TRANSFER')) {
|
||||
if ($object->status == BonPrelevement::STATUS_DEBITED || $object->status == BonPrelevement::STATUS_CREDITED) {
|
||||
if ($object->type == 'bank-transfer') {
|
||||
print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit'));
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans("ReOpen"), '', 'default', 'card.php?action=reopen&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'credit'));
|
||||
}
|
||||
// Cancel
|
||||
if ($object->status == BonPrelevement::STATUS_TRANSFERED) {
|
||||
if ($object->type == 'bank-transfer') {
|
||||
print dolGetButtonAction($langs->trans("Cancel"), '', 'cancel', 'card.php?action=setcancel&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit'));
|
||||
} else {
|
||||
print dolGetButtonAction($langs->trans("Cancel"), '', 'cancel', 'card.php?action=setcancel&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'credit'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ class BonPrelevement extends CommonObject
|
||||
const STATUS_TRANSFERED = 1;
|
||||
const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
|
||||
const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
|
||||
const STATUS_CANCELED = -1;
|
||||
|
||||
|
||||
/**
|
||||
@@ -2909,6 +2910,8 @@ class BonPrelevement extends CommonObject
|
||||
$this->labelStatus[self::STATUS_CREDITED] = $langs->transnoentitiesnoconv('StatusCredited');
|
||||
$this->labelStatusShort[self::STATUS_CREDITED] = $langs->transnoentitiesnoconv('StatusCredited');
|
||||
}
|
||||
$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
|
||||
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
|
||||
}
|
||||
|
||||
$statusType = 'status1';
|
||||
@@ -2918,6 +2921,9 @@ class BonPrelevement extends CommonObject
|
||||
if ($status == self::STATUS_CREDITED || $status == self::STATUS_DEBITED) {
|
||||
$statusType = 'status6';
|
||||
}
|
||||
if ($status == self::STATUS_CANCELED) {
|
||||
$statusType = 'status9';
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
@@ -14374,6 +14374,8 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
||||
$class = 'butAction butActionEmail';
|
||||
} elseif ($actionType == 'clone') {
|
||||
$class = 'butAction butActionClone';
|
||||
} elseif ($actionType == 'cancel') {
|
||||
$class = 'butAction butActionDelete';
|
||||
} elseif ($actionType == 'danger' || $actionType == 'delete') {
|
||||
$class = 'butAction butActionDelete';
|
||||
if (!empty($url) && strpos($url, 'token=') === false) {
|
||||
|
||||
Reference in New Issue
Block a user