Fix phpcs
This commit is contained in:
parent
61b7564664
commit
4634312306
@ -71,7 +71,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'bomcard'; // To manage different context of search
|
||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
@ -110,7 +110,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
@ -154,7 +154,7 @@ if (empty($reshook))
|
||||
$form=new Form($db);
|
||||
$formfile=new FormFile($db);
|
||||
|
||||
llxHeader('','BillOfMaterials','');
|
||||
llxHeader('', 'BillOfMaterials', '');
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
@ -289,7 +289,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
/*
|
||||
|
||||
@ -48,9 +48,9 @@ dol_include_once('/bom/lib/bom_bom.lib.php');
|
||||
$langs->loadLangs(array("bom@bom","companies","other","mails"));
|
||||
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$confirm=GETPOST('confirm');
|
||||
$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check - Protection if external user
|
||||
@ -59,9 +59,9 @@ $ref = GETPOST('ref', 'alpha');
|
||||
//$result = restrictedArea($user, 'bom', $id);
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -123,7 +123,7 @@ if ($object->id)
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php',1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
$linkback = '<a href="' .dol_buildpath('/bom/bom_list.php', 1) . '?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomlist
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
@ -115,7 +115,7 @@ $search_all=trim(GETPOST("search_all", 'alpha'));
|
||||
$search=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
|
||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -151,7 +151,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -216,7 +216,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label']))
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
$sql=preg_replace('/, $/', '', $sql);
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
@ -251,7 +251,7 @@ $sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/, $/','', $sql);
|
||||
*/
|
||||
|
||||
$sql.=$db->order($sortfield,$sortorder);
|
||||
$sql.=$db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@ -333,7 +333,7 @@ $arrayofmassactions = array(
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->bom->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction','int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array();
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -372,7 +372,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -457,7 +457,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
}
|
||||
}
|
||||
|
||||
@ -572,7 +572,7 @@ print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
{
|
||||
$hidegeneratedfilelistifempty=1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
|
||||
|
||||
@ -85,7 +85,7 @@ class BillOfMaterialsApi extends DolibarrApi
|
||||
throw new RestException(404, 'BillOfMaterials not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom',$this->bom->id)) {
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ class BillOfMaterialsApi extends DolibarrApi
|
||||
throw new RestException(404, 'BillOfMaterials not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom',$this->bom->id)) {
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ class BillOfMaterialsApi extends DolibarrApi
|
||||
throw new RestException(404, 'BillOfMaterials not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom',$this->bom->id)) {
|
||||
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
|
||||
@ -502,28 +502,28 @@ class BillOfMaterials extends CommonObject
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1085,28 +1085,28 @@ class BillOfMaterialsLine extends CommonObject
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1205,4 +1205,3 @@ class BillOfMaterialsLine extends CommonObject
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -121,4 +121,4 @@ function bomPrepareHead($object)
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@bom');
|
||||
|
||||
return $head;
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ $search_phone_pro=GETPOST("search_phone_pro", 'alpha');
|
||||
$search_phone_mobile=GETPOST("search_phone_mobile", 'alpha');
|
||||
$search_fax=GETPOST("search_fax", 'alpha');
|
||||
$search_email=GETPOST("search_email", 'alpha');
|
||||
$search_no_email=GETPOST("search_no_email",'int');
|
||||
$search_no_email=GETPOST("search_no_email", 'int');
|
||||
$search_skype=GETPOST("search_skype", 'alpha');
|
||||
$search_twitter=GETPOST("search_twitter", 'alpha');
|
||||
$search_facebook=GETPOST("search_facebook", 'alpha');
|
||||
@ -620,7 +620,7 @@ if (! empty($arrayfields['p.email']['checked']))
|
||||
if (! empty($arrayfields['p.no_email']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'),'1'=>$langs->trans('Yes')),$search_no_email);
|
||||
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.skype']['checked']))
|
||||
@ -718,7 +718,7 @@ if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field
|
||||
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'],$_SERVER["PHP_SELF"],"p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'],$_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -27,10 +27,10 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
require '../../main.inc.php'; // Load $user and permissions
|
||||
|
||||
$id= GETPOST('id');
|
||||
$w= GETPOST('w');
|
||||
$h= GETPOST('h');
|
||||
$query= GETPOST('query');
|
||||
$id = GETPOST('id', 'int');
|
||||
$w = GETPOST('w', 'int');
|
||||
$h = GETPOST('h', 'int');
|
||||
$query= GETPOST('query', 'alpha');
|
||||
|
||||
|
||||
|
||||
@ -48,11 +48,11 @@ if ($query=="cat")
|
||||
|
||||
$object = new Categorie($db);
|
||||
$result = $object->fetch($id);
|
||||
|
||||
|
||||
$upload_dir = $conf->categorie->multidir_output[$object->entity];
|
||||
$pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/";
|
||||
$dir = $upload_dir.'/'.$pdir;
|
||||
|
||||
|
||||
foreach ($object->liste_photos($dir) as $key => $obj)
|
||||
{
|
||||
if ($obj['photo_vignette'])
|
||||
@ -63,12 +63,11 @@ if ($query=="cat")
|
||||
{
|
||||
$filename=$obj['photo'];
|
||||
}
|
||||
$viewfilename=$obj['photo'];
|
||||
$file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename);
|
||||
header('Location: '.$file);
|
||||
exit;
|
||||
}
|
||||
header('Location: ../../public/theme/common/nophoto.png');
|
||||
header('Location: ../../public/theme/common/nophoto.png');
|
||||
}
|
||||
elseif ($query=="pro")
|
||||
{
|
||||
@ -77,15 +76,17 @@ elseif ($query=="pro")
|
||||
$objProd = new Product($db);
|
||||
$objProd->fetch($id);
|
||||
$image=$objProd->show_photos('product', $conf->product->multidir_output[$entity], 'small', 1);
|
||||
|
||||
preg_match( '@src="([^"]+)"@' , $image, $match );
|
||||
|
||||
preg_match('@src="([^"]+)"@', $image, $match);
|
||||
$file = array_pop($match);
|
||||
if ($file=="") header('Location: ../../public/theme/common/nophoto.png');
|
||||
if ($file=="") header('Location: ../../public/theme/common/nophoto.png');
|
||||
else header('Location: '.$file);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO We don't need this. Size of image must be defined on HTML page, image must NOT be resize when downloaded.
|
||||
|
||||
// The file
|
||||
$filename = $query.".jpg";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user