NEW Can set position of images in module tickets
Mutualize code of method show_photo
This commit is contained in:
parent
6e52c896f2
commit
700c69e127
@ -63,7 +63,7 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
|
||||
$row->table_element_line = $table_element_line;
|
||||
$row->fk_element = $fk_element;
|
||||
$row->id = $element_id;
|
||||
$row->line_ajaxorder($newrowordertab); // This update field rank or position in table table_element_line
|
||||
$row->line_ajaxorder($newrowordertab); // This update field rank or position in table row->table_element_line
|
||||
|
||||
// Reorder line to have position of children lines sharing same counter than parent lines
|
||||
// This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
|
||||
|
||||
@ -6004,7 +6004,7 @@ abstract class CommonObject
|
||||
{
|
||||
$labeltoshow = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$labeltoshow.'</span>';
|
||||
}
|
||||
|
||||
|
||||
if (empty($onetrtd)) $out .= '<td>';
|
||||
else $out .= '<td'.($colspan?' colspan="'.($colspan+1).'"':'').'>';
|
||||
|
||||
@ -6194,6 +6194,243 @@ abstract class CommonObject
|
||||
return $buyPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show photos of an object (nbmax maximum), into several columns
|
||||
*
|
||||
* @param string $modulepart 'product', 'ticketsup', ...
|
||||
* @param string $sdir Directory to scan (full absolute path)
|
||||
* @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 $nbbyrow Number of image per line or -1 to use div. Used only if size=1.
|
||||
* @param int $showfilename 1=Show filename
|
||||
* @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 $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 $notitle 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)
|
||||
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
|
||||
*/
|
||||
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)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
||||
|
||||
$sortfield='position_name';
|
||||
$sortorder='asc';
|
||||
|
||||
$dir = $sdir . '/';
|
||||
$pdir = '/';
|
||||
if ($modulepart == 'ticketsup')
|
||||
{
|
||||
$dir .= get_exdir(0, 0, 0, 0, $this, $modulepart).$this->track_id.'/';
|
||||
$pdir .= get_exdir(0, 0, 0, 0, $this, $modulepart).$this->track_id.'/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$dir .= get_exdir(0, 0, 0, 0, $this, $modulepart).$this->ref.'/';
|
||||
$pdir .= get_exdir(0, 0, 0, 0, $this, $modulepart).$this->ref.'/';
|
||||
}
|
||||
|
||||
// For backward compatibility
|
||||
if ($modulepart == 'product' && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$dir = $sdir . '/'. get_exdir($this->id,2,0,0,$this,$modulepart) . $this->id ."/photos/";
|
||||
$pdir = '/' . get_exdir($this->id,2,0,0,$this,$modulepart) . $this->id ."/photos/";
|
||||
}
|
||||
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($dir)
|
||||
{
|
||||
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $dir);
|
||||
$relativedir = preg_replace('/^[\\/]/','',$relativedir);
|
||||
$relativedir = preg_replace('/[\\/]$/','',$relativedir);
|
||||
}
|
||||
|
||||
$dirthumb = $dir.'thumbs/';
|
||||
$pdirthumb = $pdir.'thumbs/';
|
||||
|
||||
$return ='<!-- Photo -->'."\n";
|
||||
$nbphoto=0;
|
||||
|
||||
$filearray=dol_dir_list($dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
/*if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
$filearrayold=dol_dir_list($dirold,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$filearray=array_merge($filearray, $filearrayold);
|
||||
}*/
|
||||
|
||||
completeFileArrayWithDatabaseInfo($filearray, $relativedir);
|
||||
|
||||
if (count($filearray))
|
||||
{
|
||||
if ($sortfield && $sortorder)
|
||||
{
|
||||
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
foreach($filearray as $key => $val)
|
||||
{
|
||||
$photo='';
|
||||
$file = $val['name'];
|
||||
|
||||
//if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
||||
|
||||
//if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
|
||||
if (image_format_supported($file) >= 0)
|
||||
{
|
||||
$nbphoto++;
|
||||
$photo = $file;
|
||||
$viewfilename = $file;
|
||||
|
||||
if ($size == 1 || $size == 'small') { // Format vignette
|
||||
|
||||
// Find name of thumb file
|
||||
$photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small'));
|
||||
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
|
||||
|
||||
// Get filesize of original file
|
||||
$imgarray=dol_getImageSize($dir.$photo);
|
||||
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
if ($nbphoto == 1) $return.= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
if ($nbphoto % $nbbyrow == 1) $return.= '<tr align=center valign=middle border=1>';
|
||||
$return.= '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return .= '<div class="inline-block">';
|
||||
|
||||
$return.= "\n";
|
||||
|
||||
$relativefile=preg_replace('/^\//', '', $pdir.$photo);
|
||||
if (empty($nolink))
|
||||
{
|
||||
$urladvanced=getAdvancedPreviewUrl($modulepart, $relativefile, 0, 'entity='.$this->entity);
|
||||
if ($urladvanced) $return.='<a href="'.$urladvanced.'">';
|
||||
else $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
|
||||
}
|
||||
|
||||
// Show image (width height=$maxHeight)
|
||||
// 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('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||
if ($notitle) $alt='';
|
||||
|
||||
if ($usesharelink)
|
||||
{
|
||||
if ($val['share'])
|
||||
{
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||
{
|
||||
$return.= '<!-- Show original file (thumb not yet available with shared links) -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$return.= '<!-- Show nophoto file (because file is not shared) -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||
{
|
||||
$return.= '<!-- Show thumb -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($nolink)) $return.= '</a>';
|
||||
$return.="\n";
|
||||
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
$return.= '<br>';
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if ($photo_vignette && (image_format_supported($photo) > 0) && ($this->imgWidth > $maxWidth || $this->imgHeight > $maxHeight))
|
||||
{
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||
}
|
||||
// Special cas for product
|
||||
if ($modulepart == 'product' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"), 'resize', '').'</a> ';
|
||||
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
$return.= "\n";
|
||||
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
$return.= '</td>';
|
||||
if (($nbphoto % $nbbyrow) == 0) $return.= '</tr>';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return.='</div>';
|
||||
}
|
||||
|
||||
if (empty($size)) { // Format origine
|
||||
$return.= '<img class="photo photowithmargin" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'">';
|
||||
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
// Special case for product
|
||||
if ($modulepart == 'product' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"), 'resize', '').'</a> ';
|
||||
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On continue ou on arrete de boucler ?
|
||||
if ($nbmax && $nbphoto >= $nbmax) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($size==1 || $size=='small')
|
||||
{
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
$return.= '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
if ($nbphoto) $return.= '</table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->nbphoto = $nbphoto;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -6228,7 +6465,6 @@ abstract class CommonObject
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function test if type is date
|
||||
*
|
||||
|
||||
@ -1327,7 +1327,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
$showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
|
||||
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
|
||||
@ -1346,7 +1346,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
$showimage=$object->is_photo_available($conf->ticketsup->dir_output.'/'.$object->track_id);
|
||||
$maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->ticketsup->dir_output,'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticketsup', $conf->ticketsup->dir_output,'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) {
|
||||
|
||||
@ -86,8 +86,10 @@ $formfile->form_attach_new_file(
|
||||
$savingdocmask
|
||||
);
|
||||
|
||||
// Drag and drop for up and down allowed on product, thirdparty, ...
|
||||
// The drag and drop call the page core/ajax/row.php
|
||||
$disablemove=1;
|
||||
if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product, thirdparty, ...
|
||||
if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticketsup'))) $disablemove=0;
|
||||
|
||||
// List of document
|
||||
$formfile->list_of_documents(
|
||||
|
||||
@ -705,7 +705,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.$label;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'<br>';
|
||||
$description.= $product_static->show_photos($conf->product->multidir_output[$product_static->entity],1,1,0,0,0,80);
|
||||
$description.= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
|
||||
@ -938,4 +938,5 @@ Annual=Annual
|
||||
Local=Local
|
||||
Remote=Remote
|
||||
LocalAndRemote=Local and Remote
|
||||
KeyboardShortcut=Keyboard shortcut
|
||||
KeyboardShortcut=Keyboard shortcut
|
||||
AssignedTo=Assigned to
|
||||
@ -163,7 +163,6 @@ SeeTicket=See ticket
|
||||
TicketMarkedAsRead=Ticket has been marked as read
|
||||
TicketReadOn=Read on
|
||||
TicketCloseOn=Clotured on
|
||||
UserAssignedTo=User assigned
|
||||
MarkAsRead=Mark ticket as read
|
||||
TicketMarkedAsReadButLogActionNotSaved=Ticket marked as closed but no action saved
|
||||
TicketHistory=Ticket history
|
||||
|
||||
@ -45,7 +45,7 @@ dol_include_once('/mymodule/class/myobject.class.php');
|
||||
dol_include_once('/mymodule/lib/myobject.lib.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->loadLangs(array("mymodule@mymodule","companies","other"));
|
||||
$langs->loadLangs(array("mymodule@mymodule","companies","other","mails"));
|
||||
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
@ -68,6 +68,7 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
//if (! $sortfield) $sortfield="position_name";
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new MyObject($db);
|
||||
@ -108,7 +109,6 @@ if ($object->id)
|
||||
/*
|
||||
* Show tabs
|
||||
*/
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = myobjectPrepareHead($object);
|
||||
|
||||
dol_fiche_head($head, 'document', $langs->trans("MyObject"), -1, 'myobject@mymodule');
|
||||
|
||||
@ -216,7 +216,7 @@ class ActionsCardProduct
|
||||
$this->tpl['nblignes'] = 4;
|
||||
if ($this->object->is_photo_available($conf->product->multidir_output[$this->object->entity]))
|
||||
{
|
||||
$this->tpl['photos'] = $this->object->show_photos($conf->product->multidir_output[$this->object->entity],1,1,0,0,0,80);
|
||||
$this->tpl['photos'] = $this->object->show_photos('product', $conf->product->multidir_output[$this->object->entity],1,1,0,0,0,80);
|
||||
}
|
||||
|
||||
// Nature
|
||||
|
||||
@ -211,7 +211,7 @@ class ActionsCardService
|
||||
$this->tpl['nblignes'] = 4;
|
||||
if ($this->object->is_photo_available($conf->service->multidir_output[$this->object->entity]))
|
||||
{
|
||||
$this->tpl['photos'] = $this->object->show_photos($conf->service->multidir_output[$this->object->entity],1,1,0,0,0,80);
|
||||
$this->tpl['photos'] = $this->object->show_photos('product', $conf->service->multidir_output[$this->object->entity],1,1,0,0,0,80);
|
||||
}
|
||||
|
||||
// Duration
|
||||
|
||||
@ -3559,7 +3559,7 @@ class Product extends CommonObject
|
||||
}
|
||||
if (! empty($this->entity))
|
||||
{
|
||||
$tmpphoto = $this->show_photos($conf->product->multidir_output[$this->entity],1,1,0,0,0,80);
|
||||
$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80);
|
||||
if ($this->nbphoto > 0) $label .= '<br>' . $tmpphoto;
|
||||
}
|
||||
|
||||
@ -4133,234 +4133,6 @@ class Product extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show photos of a product (nbmax maximum), into several columns
|
||||
* TODO Move this into html.formproduct.class.php
|
||||
*
|
||||
* @param string $sdir Directory to scan (full absolute path)
|
||||
* @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 $nbbyrow Number of image per line or -1 to use div. Used only if size=1.
|
||||
* @param int $showfilename 1=Show filename
|
||||
* @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 $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 $notitle 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)
|
||||
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
|
||||
*/
|
||||
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160,$nolink=0,$notitle=0,$usesharelink=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
||||
|
||||
$sortfield='position_name';
|
||||
$sortorder='asc';
|
||||
|
||||
$dir = $sdir . '/';
|
||||
$pdir = '/';
|
||||
$dir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
$pdir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$dir = $sdir . '/'. get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||
$pdir = '/' . get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||
}
|
||||
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($dir)
|
||||
{
|
||||
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $dir);
|
||||
$relativedir = preg_replace('/^[\\/]/','',$relativedir);
|
||||
$relativedir = preg_replace('/[\\/]$/','',$relativedir);
|
||||
}
|
||||
|
||||
$dirthumb = $dir.'thumbs/';
|
||||
$pdirthumb = $pdir.'thumbs/';
|
||||
|
||||
$return ='<!-- Photo -->'."\n";
|
||||
$nbphoto=0;
|
||||
|
||||
$filearray=dol_dir_list($dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
/*if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
$filearrayold=dol_dir_list($dirold,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$filearray=array_merge($filearray, $filearrayold);
|
||||
}*/
|
||||
|
||||
completeFileArrayWithDatabaseInfo($filearray, $relativedir);
|
||||
|
||||
if (count($filearray))
|
||||
{
|
||||
if ($sortfield && $sortorder)
|
||||
{
|
||||
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
foreach($filearray as $key => $val)
|
||||
{
|
||||
$photo='';
|
||||
$file = $val['name'];
|
||||
|
||||
//if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
||||
|
||||
//if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
|
||||
if (image_format_supported($file) >= 0)
|
||||
{
|
||||
$nbphoto++;
|
||||
$photo = $file;
|
||||
$viewfilename = $file;
|
||||
|
||||
if ($size == 1 || $size == 'small') { // Format vignette
|
||||
|
||||
// Find name of thumb file
|
||||
$photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small'));
|
||||
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
|
||||
|
||||
// Get filesize of original file
|
||||
$imgarray=dol_getImageSize($dir.$photo);
|
||||
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
if ($nbphoto == 1) $return.= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
if ($nbphoto % $nbbyrow == 1) $return.= '<tr align=center valign=middle border=1>';
|
||||
$return.= '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return .= '<div class="inline-block">';
|
||||
|
||||
$return.= "\n";
|
||||
|
||||
$relativefile=preg_replace('/^\//', '', $pdir.$photo);
|
||||
if (empty($nolink))
|
||||
{
|
||||
$urladvanced=getAdvancedPreviewUrl('product', $relativefile, 0, 'entity='.$this->entity);
|
||||
if ($urladvanced) $return.='<a href="'.$urladvanced.'">';
|
||||
else $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
|
||||
}
|
||||
|
||||
// Show image (width height=$maxHeight)
|
||||
// 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('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||
if ($notitle) $alt='';
|
||||
|
||||
if ($usesharelink)
|
||||
{
|
||||
if ($val['share'])
|
||||
{
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||
{
|
||||
$return.= '<!-- Show original file (thumb not yet available with shared links) -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$return.= '<!-- Show nophoto file (because file is not shared) -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||
{
|
||||
$return.= '<!-- Show thumb -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($nolink)) $return.= '</a>';
|
||||
$return.="\n";
|
||||
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
$return.= '<br>';
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if ($photo_vignette && (image_format_supported($photo) > 0) && ($this->imgWidth > $maxWidth || $this->imgHeight > $maxHeight))
|
||||
{
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"), 'resize', '').'</a> ';
|
||||
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
$return.= "\n";
|
||||
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
$return.= '</td>';
|
||||
if (($nbphoto % $nbbyrow) == 0) $return.= '</tr>';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return.='</div>';
|
||||
}
|
||||
|
||||
if (empty($size)) { // Format origine
|
||||
$return.= '<img class="photo photowithmargin" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'">';
|
||||
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"), 'resize', '').'</a> ';
|
||||
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On continue ou on arrete de boucler ?
|
||||
if ($nbmax && $nbphoto >= $nbmax) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($size==1 || $size=='small')
|
||||
{
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
$return.= '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
if ($nbphoto) $return.= '</table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->nbphoto = $nbphoto;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne tableau de toutes les photos du produit
|
||||
*
|
||||
|
||||
@ -40,10 +40,10 @@ if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
$langs->load("other");
|
||||
$langs->load("products");
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm= GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
||||
@ -93,7 +93,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
//Delete line if product propal merge is linked to a file
|
||||
// Delete line if product propal merge is linked to a file
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
{
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
@ -346,7 +346,6 @@ if ($object->id)
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Card of ticket
|
||||
* @ingroup ticketsup
|
||||
* \file htdocs/ticketsup/card.php
|
||||
* \ingroup ticketsup
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -343,7 +343,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
|
||||
print '</td></tr>';
|
||||
|
||||
// User assigned
|
||||
print '<tr><td>' . $langs->trans("UserAssignedTo") . '</td><td>';
|
||||
print '<tr><td>' . $langs->trans("AssignedTo") . '</td><td>';
|
||||
if ($object->fk_user_assign > 0) {
|
||||
$userstat->fetch($object->fk_user_assign);
|
||||
print $userstat->getNomUrl(1);
|
||||
|
||||
@ -335,7 +335,7 @@ class ActionsTicketsup
|
||||
|
||||
/*if (! ($usertoassign > 0)) {
|
||||
$error++;
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("UserAssignedTo")));
|
||||
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("AssignedTo")));
|
||||
$action = 'view';
|
||||
}*/
|
||||
|
||||
|
||||
@ -42,6 +42,10 @@ class Ticketsup extends CommonObject
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'ticketsup';
|
||||
/**
|
||||
* @var string Name of field for link to tickets
|
||||
*/
|
||||
public $fk_element='fk_ticket';
|
||||
/**
|
||||
* @var int Does ticketsupcore support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
@ -178,7 +182,7 @@ class Ticketsup extends CommonObject
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty"),
|
||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToProject"),
|
||||
'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
|
||||
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AuthorAssign', 'visible'=>1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
|
||||
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
|
||||
'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>12, 'notnull'=>-1, 'searchall'=>1, 'help'=>""),
|
||||
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>60, 'notnull'=>-1,),
|
||||
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-2, 'enabled'=>1, 'position'=>40, 'notnull'=>1),
|
||||
@ -2469,182 +2473,6 @@ class Ticketsup extends CommonObject
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show photos of a product (nbmax maximum), into several columns
|
||||
* TODO Move this into html.formproduct.class.php
|
||||
*
|
||||
* @param string $sdir Directory to scan
|
||||
* @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 $nbbyrow Number of image per line or -1 to use div. Used only if size=1.
|
||||
* @param int $showfilename 1=Show filename
|
||||
* @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 $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
|
||||
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
|
||||
*/
|
||||
function show_photos($sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
|
||||
|
||||
$dir = $sdir . '/';
|
||||
$pdir = '/';
|
||||
$dir .= get_exdir(0, 0, 0, 0, $this, 'ticketsup') . $this->track_id . '/';
|
||||
$pdir .= get_exdir(0, 0, 0, 0, $this, 'ticketsup') . $this->track_id . '/';
|
||||
|
||||
$dirthumb = $dir . 'thumbs/';
|
||||
$pdirthumb = $pdir . 'thumbs/';
|
||||
|
||||
$return = '<!-- Photo -->' . "\n";
|
||||
$nbphoto = 0;
|
||||
|
||||
$dir_osencoded = dol_osencode($dir);
|
||||
if (file_exists($dir_osencoded)) {
|
||||
$handle = opendir($dir_osencoded);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) != false) {
|
||||
$photo = '';
|
||||
|
||||
if (!utf8_check($file)) {
|
||||
$file = utf8_encode($file);
|
||||
}
|
||||
// To be sure file is stored in UTF8 in memory
|
||||
if (dol_is_file($dir . $file) && preg_match('/(' . $this->regeximgext . ')$/i', $dir . $file)) {
|
||||
$nbphoto++;
|
||||
$photo = $file;
|
||||
$viewfilename = $file;
|
||||
|
||||
if ($size == 1 || $size == 'small') { // Format vignette
|
||||
// Find name of thumb file
|
||||
$photo_vignette = basename(getImageFileNameForSize($dir . $file, '_small', '.png'));
|
||||
if (!dol_is_file($dirthumb . $photo_vignette)) {
|
||||
$photo_vignette = '';
|
||||
}
|
||||
|
||||
// Get filesize of original file
|
||||
$imgarray = dol_getImageSize($dir . $photo);
|
||||
|
||||
if ($nbbyrow > 0) {
|
||||
if ($nbphoto == 1) {
|
||||
$return .= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
}
|
||||
|
||||
if ($nbphoto % $nbbyrow == 1) {
|
||||
$return .= '<tr align=center valign=middle border=1>';
|
||||
}
|
||||
|
||||
$return .= '<td width="' . ceil(100 / $nbbyrow) . '%" class="photo">';
|
||||
} elseif ($nbbyrow < 0) {
|
||||
$return .= '<div class="inline-block">';
|
||||
}
|
||||
|
||||
$return .= "\n";
|
||||
if (empty($nolink)) {
|
||||
$return .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=ticketsup&entity=' . $this->entity . '&file=' . urlencode($pdir . $photo) . '" class="aphoto" target="_blank">';
|
||||
}
|
||||
|
||||
// Show image (width height=$maxHeight)
|
||||
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
|
||||
$alt = $langs->transnoentitiesnoconv('File') . ': ' . $pdir . $photo;
|
||||
$alt .= ' - ' . $langs->transnoentitiesnoconv('Size') . ': ' . $imgarray['width'] . 'x' . $imgarray['height'];
|
||||
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
|
||||
$return .= '<!-- Show thumb -->';
|
||||
$return .= '<img class="photo photowithmargin" border="0" ' . ($conf->dol_use_jmobile ? 'max-height' : 'height') . '="' . $maxHeight . '" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=ticketsup&entity=' . $this->entity . '&file=' . urlencode($pdirthumb . $photo_vignette) . '" title="' . dol_escape_htmltag($alt) . '">';
|
||||
} else {
|
||||
$return .= '<!-- Show original file -->';
|
||||
$return .= '<img class="photo photowithmargin" border="0" ' . ($conf->dol_use_jmobile ? 'max-height' : 'height') . '="' . $maxHeight . '" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=ticketsup&entity=' . $this->entity . '&file=' . urlencode($pdir . $photo) . '" title="' . dol_escape_htmltag($alt) . '">';
|
||||
}
|
||||
|
||||
if (empty($nolink)) {
|
||||
$return .= '</a>';
|
||||
}
|
||||
|
||||
$return .= "\n";
|
||||
|
||||
if ($showfilename) {
|
||||
$return .= '<br>' . $viewfilename;
|
||||
}
|
||||
|
||||
if ($showaction) {
|
||||
$return .= '<br>';
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if ($photo_vignette && preg_match('/(' . $this->regeximgext . ')$/i', $photo) && ($this->imgWidth > $maxWidth || $this->imgHeight > $maxHeight)) {
|
||||
$return .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=addthumb&file=' . urlencode($pdir . $viewfilename) . '">' . img_picto($langs->trans('GenerateThumb'), 'refresh') . ' </a>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
// Link to resize
|
||||
$return .= '<a href="' . DOL_URL_ROOT . '/core/photos_resize.php?modulepart=' . urlencode('ticketsup') . '&id=' . $this->id . '&file=' . urlencode($pdir . $viewfilename) . '" title="' . dol_escape_htmltag($langs->trans("Resize")) . '">' . img_picto($langs->trans("Resize"), 'resize', '') . '</a> ';
|
||||
|
||||
// Link to delete
|
||||
$return .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=delete&file=' . urlencode($pdir . $viewfilename) . '">';
|
||||
$return .= img_delete() . '</a>';
|
||||
}
|
||||
}
|
||||
$return .= "\n";
|
||||
|
||||
if ($nbbyrow > 0) {
|
||||
$return .= '</td>';
|
||||
if (($nbphoto % $nbbyrow) == 0) {
|
||||
$return .= '</tr>';
|
||||
}
|
||||
} elseif ($nbbyrow < 0) {
|
||||
$return .= '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($size)) { // Format origine
|
||||
$return .= '<img class="photo photowithmargin" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=ticketsup&entity=' . $this->entity . '&file=' . urlencode($pdir . $photo) . '">';
|
||||
|
||||
if ($showfilename) {
|
||||
$return .= '<br>' . $viewfilename;
|
||||
}
|
||||
|
||||
if ($showaction) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
// Link to resize
|
||||
$return .= '<a href="' . DOL_URL_ROOT . '/core/photos_resize.php?modulepart=' . urlencode('ticketsup') . '&id=' . $this->id . '&file=' . urlencode($pdir . $viewfilename) . '" title="' . dol_escape_htmltag($langs->trans("Resize")) . '">' . img_picto($langs->trans("Resize"), 'resize', '') . '</a> ';
|
||||
|
||||
// Link to delete
|
||||
$return .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&action=delete&file=' . urlencode($pdir . $viewfilename) . '">';
|
||||
$return .= img_delete() . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On continue ou on arrete de boucler ?
|
||||
if ($nbmax && $nbphoto >= $nbmax) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($size == 1 || $size == 'small') {
|
||||
if ($nbbyrow > 0) {
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow) {
|
||||
$return .= '<td width="' . ceil(100 / $nbbyrow) . '%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
if ($nbphoto) {
|
||||
$return .= '</table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
$this->nbphoto = $nbphoto;
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file ticketsup/contact.php
|
||||
* \ingroup ticketsup
|
||||
* \brief Contacts of tickets
|
||||
* \file htdocs/ticketsup/contact.php
|
||||
* \ingroup ticketsup
|
||||
* \brief Contacts of tickets
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file /ticketsup/document.php
|
||||
* \file htdocs/ticketsup/document.php
|
||||
* \ingroup ticketsup
|
||||
* \brief files linked to a ticket
|
||||
*/
|
||||
@ -33,13 +33,13 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/lib/company.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->loadLangs(array("companies","other","ticketsup"));
|
||||
$langs->loadLangs(array("companies","other","ticketsup","mails"));
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$track_id = GETPOST('track_id', 'alpha');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
if (!$user->rights->ticketsup->read) {
|
||||
@ -50,18 +50,12 @@ if (!$user->rights->ticketsup->read) {
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if ($page == -1) {
|
||||
$page = 0;
|
||||
}
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "name";
|
||||
}
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="position_name";
|
||||
|
||||
$object = new Ticketsup($db);
|
||||
$result = $object->fetch($id, $ref, $track_id);
|
||||
@ -97,15 +91,11 @@ $form = new Form($db);
|
||||
$help_url = '';
|
||||
llxHeader('', $langs->trans("TicketDocumentsLinked") . ' - ' . $langs->trans("Files"), $help_url);
|
||||
|
||||
if ($object->id) {
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
if (!empty($conf->notification->enabled)) {
|
||||
$langs->load("mails");
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
if ($object->id)
|
||||
{
|
||||
/*
|
||||
* Show tabs
|
||||
*/
|
||||
if ($socid > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
$head = societe_prepare_head($object->thirdparty);
|
||||
@ -119,6 +109,7 @@ if ($object->id) {
|
||||
} elseif ($user->societe_id > 0) {
|
||||
$object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
|
||||
}
|
||||
|
||||
$head = ticketsup_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'tabTicketDocument', $langs->trans("Ticket"), 0, 'ticketsup');
|
||||
@ -153,16 +144,16 @@ if ($object->id) {
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
// For compatibility we use track ID for directory
|
||||
$object->ref = $object->track_id;
|
||||
$object->ref = $object->track_id; // For compatibility we use track ID for directory
|
||||
$modulepart = 'ticketsup';
|
||||
$permission = $user->rights->ticketsup->write;
|
||||
$permtoedit = $user->rights->ticketsup->write;
|
||||
$param = '&id=' . $object->id;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
|
||||
print "<br><br>";
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
accessforbidden('', 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -16,9 +16,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* History of ticket
|
||||
*
|
||||
* @package ticketsup
|
||||
* \file htdocs/ticketsup/history.php
|
||||
* \ingroup ticketsup
|
||||
* \brief History of ticket
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
@ -16,9 +16,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Index page for ticket module
|
||||
*
|
||||
* @package ticketsup
|
||||
* \file htdocs/ticketsup/history.php
|
||||
* \ingroup ticketsup
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) - 2013-2018 Jean-François FERRY <hello@librethic.io>
|
||||
* 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,9 +17,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tickets List
|
||||
*
|
||||
* @package ticketsup
|
||||
* \file htdocs/ticketsup/list.php
|
||||
* \ingroup ticketsup
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -437,7 +436,7 @@ print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="' . $mode . '" >';
|
||||
|
||||
$buttontocreate = '<div class="inline-block divButAction"><a class="butAction" href="new.php?action=create_ticket' . ($socid ? '&socid=' . $socid : '') . ($projectid ? '&origin=projet_project&originid=' . $projectid : '') . '">' . $langs->trans('NewTicket') . '</a></div>';
|
||||
$buttontocreate = '<a class="butAction" href="new.php?action=create_ticket' . ($socid ? '&socid=' . $socid : '') . ($projectid ? '&origin=projet_project&originid=' . $projectid : '') . '">' . $langs->trans('NewTicket') . '</a>';
|
||||
|
||||
print_barre_liste($langs->trans('TicketList'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_ticketsup', 0, $buttontocreate, '', $limit);
|
||||
|
||||
|
||||
@ -17,9 +17,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Display form to add new ticket
|
||||
*
|
||||
* @package ticketsup
|
||||
* \file htdocs/ticketsup/new.php
|
||||
* \ingroup ticketsup
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user