Merge pull request #16351 from aspangaro/14a16

NEW: Add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD
This commit is contained in:
Laurent Destailleur
2021-02-19 18:20:17 +01:00
committed by GitHub
3 changed files with 15 additions and 0 deletions

View File

@@ -2150,6 +2150,12 @@ if ($action == 'create')
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show direct download link
if ($object->statut != Contrat::STATUS_DRAFT && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD))
{
print '<br><!-- Link to download main doc -->'."\n";
print showDirectDownloadLink($object).'<br>';
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@@ -4884,6 +4884,9 @@ abstract class CommonObject
if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) { if ($this->element == 'bank_account' && !empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey = true; $setsharekey = true;
} }
if ($this->element == 'contrat' && !empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD)) {
$setsharekey = true;
}
if ($setsharekey) { if ($setsharekey) {
if (empty($ecmfile->share)) // Because object not found or share not set yet if (empty($ecmfile->share)) // Because object not found or share not set yet

View File

@@ -6558,6 +6558,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
if (is_object($object) && $object->element == 'commande') $typeforonlinepayment = 'order'; if (is_object($object) && $object->element == 'commande') $typeforonlinepayment = 'order';
if (is_object($object) && $object->element == 'facture') $typeforonlinepayment = 'invoice'; if (is_object($object) && $object->element == 'facture') $typeforonlinepayment = 'invoice';
if (is_object($object) && $object->element == 'member') $typeforonlinepayment = 'member'; if (is_object($object) && $object->element == 'member') $typeforonlinepayment = 'member';
if (is_object($object) && $object->element == 'contrat') $typeforonlinepayment = 'contract';
$url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']); $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']);
$paymenturl = $url; $paymenturl = $url;
} }
@@ -6579,10 +6580,15 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
{ {
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element); $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element);
} else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = ''; } else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = '';
if (!empty($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'contrat')
{
$substitutionarray['__DIRECTDOWNLOAD_URL_CONTRACT__'] = $object->getLastMainDocLink($object->element);
} else $substitutionarray['__DIRECTDOWNLOAD_URL_CONTRACT__'] = '';
if (is_object($object) && $object->element == 'propal') $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id; if (is_object($object) && $object->element == 'propal') $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id;
if (is_object($object) && $object->element == 'commande') $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id; if (is_object($object) && $object->element == 'commande') $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id;
if (is_object($object) && $object->element == 'facture') $substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT."/compta/facture/card.php?id=".$object->id; if (is_object($object) && $object->element == 'facture') $substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT."/compta/facture/card.php?id=".$object->id;
if (is_object($object) && $object->element == 'contrat') $substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id;
} }
if (is_object($object) && $object->element == 'action') if (is_object($object) && $object->element == 'action')