Decline reason for partnership management
This commit is contained in:
parent
0d4a1d061a
commit
ba93ccaa01
@ -40,6 +40,8 @@ PartnershipManagedFor=Partnership managed for
|
|||||||
PartnershipDedicatedToThisThirdParty=Partnership dedicated to this third party
|
PartnershipDedicatedToThisThirdParty=Partnership dedicated to this third party
|
||||||
DatePartnershipStart=Start date
|
DatePartnershipStart=Start date
|
||||||
DatePartnershipEnd=End date
|
DatePartnershipEnd=End date
|
||||||
|
ReasonDecline=Decline reason
|
||||||
|
ReasonDeclineOrCancel=Decline reason
|
||||||
|
|
||||||
#
|
#
|
||||||
# Template Mail
|
# Template Mail
|
||||||
|
|||||||
@ -87,13 +87,13 @@ llxHeader('', $langs->trans($page_name));
|
|||||||
// Subheader
|
// Subheader
|
||||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_partnership@partnership');
|
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||||
|
|
||||||
// Configuration header
|
// Configuration header
|
||||||
$head = partnershipAdminPrepareHead();
|
$head = partnershipAdminPrepareHead();
|
||||||
print dol_get_fiche_head($head, 'about', '', 0, 'partnership@partnership');
|
print dol_get_fiche_head($head, 'about', '', 0, 'partnership@partnership');
|
||||||
|
|
||||||
dol_include_once('/partnership/core/modules/modPartnership.class.php');
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/modPartnership.class.php';
|
||||||
$tmpmodule = new modPartnership($db);
|
$tmpmodule = new modPartnership($db);
|
||||||
print $tmpmodule->getDescLong();
|
print $tmpmodule->getDescLong();
|
||||||
|
|
||||||
|
|||||||
@ -849,21 +849,24 @@ class Partnership extends CommonObject
|
|||||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||||
* @return int <0 if KO, 0=Nothing done, >0 if OK
|
* @return int <0 if KO, 0=Nothing done, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function refused($user, $notrigger = '')
|
public function refused($user, $reasondeclinenote = '', $notrigger = 0)
|
||||||
{
|
{
|
||||||
// Protection
|
// Protection
|
||||||
if ($this->status == self::STATUS_REFUSED) {
|
if ($this->status == self::STATUS_REFUSED) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->partnership->write))
|
$this->status = self::STATUS_REFUSED;
|
||||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->partnership_advance->validate))))
|
$this->reason_decline_or_cancel = $reasondeclinenote;
|
||||||
{
|
|
||||||
$this->error='Permission denied';
|
|
||||||
return -1;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return $this->setStatusCommon($user, self::STATUS_REFUSED, $notrigger, 'PARTNERSHIP_REFUSE');
|
$result = $this->update($user);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$this->reason_decline_or_cancel = $reasondeclinenote;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -209,10 +209,13 @@ if (empty($reshook)) {
|
|||||||
if ($object->statut != $object::STATUS_REFUSED) {
|
if ($object->statut != $object::STATUS_REFUSED) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$result = $object->refused($user, GETPOST('reason_decline_or_cancel', 'alpha'));
|
$result = $object->refused($user, GETPOST('reason_decline_or_cancel', 'restricthtml'));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
} else {
|
||||||
|
$object->reason_decline_or_cancel = GETPOST('reason_decline_or_cancel', 'restricthtml');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
@ -249,6 +252,7 @@ if (empty($reshook)) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) $object->fields['reason_decline_or_cancel']['visible'] = 3;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -400,7 +404,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if ($action == 'refuse') {
|
if ($action == 'refuse') {
|
||||||
//Form to close proposal (signed or not)
|
//Form to close proposal (signed or not)
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel', 'value' => '') // Field to complete private note (not replace)
|
array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel minwidth400', 'value' => '') // Field to complete private note (not replace)
|
||||||
);
|
);
|
||||||
|
|
||||||
// if (!empty($conf->notification->enabled)) {
|
// if (!empty($conf->notification->enabled)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user