Support of pdf preview on supplier orders

This commit is contained in:
Laurent Destailleur 2017-05-04 19:11:19 +02:00
parent bf616cbe05
commit 39d9a0f979
4 changed files with 24 additions and 18 deletions

View File

@ -1628,8 +1628,14 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
// Wrapping pour les apercu intervention
elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output))
{
if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu commande
elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output))
{
if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1;
$original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file;
}
// Wrapping pour les images des stats propales
elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp))

View File

@ -1065,11 +1065,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
$modulepart='unknown';
if ($object->element == 'societe') $modulepart='societe';
if ($object->element == 'contact') $modulepart='contact';
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
if ($object->element == 'societe') $modulepart='societe';
if ($object->element == 'contact') $modulepart='contact';
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
if (class_exists("Imagick"))
{
if ($object->element == 'propal') $modulepart='propal';
@ -1077,6 +1077,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'facture') $modulepart='facture';
if ($object->element == 'fichinter') $modulepart='ficheinter';
if ($object->element == 'contrat') $modulepart='contract';
if ($object->element == 'order_supplier') $modulepart='supplier_order';
}
if ($object->element == 'product')
@ -1102,12 +1103,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{
if ($showimage)
{
if ($modulepart != 'unknown')
if ($modulepart != 'unknown')
{
$phototoshow='';
// Check if a preview file is available
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract')) && class_exists("Imagick"))
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order')) && class_exists("Imagick"))
{
$objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->$modulepart->dir_output . "/";
@ -1137,7 +1137,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (file_exists($fileimage))
{
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
$phototoshow.= '<img height="70" class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
$phototoshow.= '<img height="70" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
$phototoshow.= '</div></div>';
}
// Si fichier png PDF de plus d'1 page trouve
@ -1145,7 +1145,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{
$preview = preg_replace('/\.png/','',$relativepathimage) . "-0.png";
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
$phototoshow.= '<img height="70" class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($preview).'"><p>';
$phototoshow.= '<img height="70" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($preview).'"><p>';
$phototoshow.= '</div></div>';
}
}
@ -1171,7 +1171,6 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$width=80;
$cssclass='photorefcenter';
$nophoto=img_picto('', 'title_agenda', '', false, 1);
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.$nophoto.'"></div></div>';
}
else
{
@ -1179,8 +1178,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$picto = $object->picto;
if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub
$nophoto=img_picto('', 'object_'.$picto, '', false, 1);
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.$nophoto.'"></div></div>';
}
$morehtmlleft.='<!-- No photo to show --><div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.$nophoto.'"></div></div>';
$morehtmlleft.='</div>';
}
}

View File

@ -3002,6 +3002,9 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; }
margin-bottom: 2px;
margin-top: 10px;
}
.photowithborder {
border: 1px solid #f0f0f0;
}
.photointooltip {
margin-top: 6px;
margin-bottom: 6px;

View File

@ -3115,10 +3115,8 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; }
margin-bottom: 2px;
margin-top: 2px;
}
.photowithmargin {
/* -webkit-box-shadow: 0px 0px 3px #777;
-moz-box-shadow: 0px 0px 3px #777;
box-shadow: 0px 0px 3px #777;*/
.photowithborder {
border: 1px solid #f0f0f0;
}
.photointoolitp {
margin-top: 8px;