2
0
forked from Wavyzz/dolibarr

NEW Tooltip to explain how to add a photo on product

This commit is contained in:
Laurent Destailleur
2023-01-17 10:22:23 +01:00
parent 4cf4da973c
commit 7668233d0c
3 changed files with 24 additions and 19 deletions

View File

@@ -8583,21 +8583,21 @@ abstract class CommonObject
/** /**
* Show photos of an object (nbmax maximum), into several columns * Show photos of an object (nbmax maximum), into several columns
* *
* @param string $modulepart 'product', 'ticket', ... * @param string $modulepart 'product', 'ticket', ...
* @param string $sdir Directory to scan (full absolute path) * @param string $sdir Directory to scan (full absolute path)
* @param int $size 0=original size, 1='small' use thumbnail if possible * @param int $size 0=original size, 1='small' use thumbnail if possible
* @param int $nbmax Nombre maximum de photos (0=pas de max) * @param int $nbmax Nombre maximum de photos (0=pas de max)
* @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'. * @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'.
* @param int $showfilename 1=Show filename * @param int $showfilename 1=Show filename
* @param int $showaction 1=Show icon with action links (resize, delete) * @param int $showaction 1=Show icon with action links (resize, delete)
* @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image. * @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image.
* @param int $maxWidth Max width of original image when size='small' * @param int $maxWidth Max width of original image when size='small'
* @param int $nolink Do not add a href link to view enlarged imaged into a new tab * @param int $nolink Do not add a href link to view enlarged imaged into a new tab
* @param int $notitle Do not add title tag on image * @param int|string $overwritetitle Do not add title tag on image
* @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead)
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
*/ */
public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0) public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $overwritetitle = 0, $usesharelink = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $user, $langs; global $conf, $user, $langs;
@@ -8700,8 +8700,12 @@ abstract class CommonObject
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
$alt = $langs->transnoentitiesnoconv('File').': '.$relativefile; $alt = $langs->transnoentitiesnoconv('File').': '.$relativefile;
$alt .= ' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; $alt .= ' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
if ($notitle) { if ($overwritetitle) {
$alt = ''; if (is_numeric($overwritetitle)) {
$alt = '';
} else {
$alt = $overwritetitle;
}
} }
$addphotorefcss = 1; $addphotorefcss = 1;

View File

@@ -2122,14 +2122,14 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$maxvisiblephotos = 1; $maxvisiblephotos = 1;
} }
if ($showimage) { if ($showimage) {
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>'; $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0, '').'</div>';
} else { } else {
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
$nophoto = ''; $nophoto = '';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"></div>'; $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"></div>';
} else { // Show no photo link } else { // Show no photo link
$nophoto = '/public/theme/common/nophoto.png'; $nophoto = '/public/theme/common/nophoto.png';
$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'"></div>'; $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" title="'.dol_escape_htmltag($langs->trans("UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv("Documents"))).'" alt="No photo"'.($width ? ' style="width: '.$width.'px"' : '').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
} }
} }
} elseif ($object->element == 'ticket') { } elseif ($object->element == 'ticket') {

View File

@@ -1219,4 +1219,5 @@ NoSpecificContactAddress=No specific contact or address
NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate. NoSpecificContactAddressBis=This tab is dedicated to force specific contacts or addresses for the current object. Use it only if you want to define one or several specific contacts or addresses for the object when the information on the thirdparty is not enough or not accurate.
HideOnVCard=Hide %s HideOnVCard=Hide %s
AddToContacts=Add address to my contacts AddToContacts=Add address to my contacts
LastAccess=Last access LastAccess=Last access
UploadAnImageToSeeAPhotoHere=Upload an image from the tab %s to see a photo here