2
0
forked from Wavyzz/dolibarr

Add link to make a direct download on card

This commit is contained in:
Laurent Destailleur
2017-11-04 17:11:58 +01:00
parent 403067812d
commit bac6a434f4
4 changed files with 54 additions and 6 deletions

View File

@@ -2368,13 +2368,19 @@ if ($action == 'create')
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show online signature link // Show online signature link
$useonlinepayment = $conf->global->MAIN_FEATURES_LEVEL; $useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
if ($object->statut != Propal::STATUS_DRAFT && $useonlinepayment) if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature)
{ {
print '<br>'; print '<br><!-- Link to sign -->';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
print showOnlineSignatureUrl('proposal', $object->ref); print showOnlineSignatureUrl('proposal', $object->ref).'<br>';
}
if ($object->statut != Propal::STATUS_DRAFT && ! empty($conf->global->PROPOSAL_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

@@ -2584,6 +2584,20 @@ if ($action == 'create' && $user->rights->commande->creer)
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show online signature link
$useonlinepayment = $conf->global->ORDER_SHOW_ONLINE_PAYMENT_ON_ORDER;
if ($object->statut != Commande::STATUS_DRAFT && $useonlinepayment)
{
print '<br><!-- Link to pay -->';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
print showOnlinePaymentUrl('order', $object->ref).'<br>';
}
if ($object->statut != Commande::STATUS_DRAFT && ! empty($conf->global->ORDER_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

@@ -4382,9 +4382,15 @@ else if ($id > 0 || ! empty($ref))
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment) if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment)
{ {
print '<br>'; print '<br><!-- Link to pay -->'."\n";
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
print showOnlinePaymentUrl('invoice', $object->ref); print showOnlinePaymentUrl('invoice', $object->ref).'<br>';
}
if ($object->statut != Facture::STATUS_DRAFT && ! empty($conf->global->INVOICE_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

@@ -6649,6 +6649,28 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
return $res; return $res;
} }
/**
* Return string with full Url
*
* @param Object $object Object
* @return string Url string
*/
function showDirectDownloadLink($object)
{
global $conf, $langs;
$out='';
$url = $object->getLastMainDocLink($object->element);
if ($url)
{
$out.= img_picto('','object_globe.png').' '.$langs->trans("DirectDownloadLink").'<br>';
$out.= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'">';
$out.= ajax_autoselect("directdownloadlink", 0);
}
return $out;
}
/** /**
* Return the filename of file to get the thumbs * Return the filename of file to get the thumbs
* *