Qual: Removed errors reported by PHPCodeSniffer
This commit is contained in:
parent
fbe292a439
commit
482a205936
@ -322,12 +322,12 @@ else if ($_GET["id"] || $_GET["ref"])
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Status (to sell)
|
// Status (to sell)
|
||||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||||
print $product->getLibStatut(2,0);
|
print $product->getLibStatut(2,0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status (to buy)
|
// Status (to buy)
|
||||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||||
print $product->getLibStatut(2,1);
|
print $product->getLibStatut(2,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -425,7 +425,12 @@ else if ($_GET["id"] || $_GET["ref"])
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction Barre d'actions
|
* Function to output a HTML select for a category
|
||||||
|
*
|
||||||
|
* @param DoliDb $db Database handler
|
||||||
|
* @param Object $object Object we want to see categories it can be classified into
|
||||||
|
* @param int $typeid Type of category (0, 1, 2, 3)
|
||||||
|
* @return int 0
|
||||||
*/
|
*/
|
||||||
function formCategory($db,$object,$typeid)
|
function formCategory($db,$object,$typeid)
|
||||||
{
|
{
|
||||||
@ -468,7 +473,7 @@ function formCategory($db,$object,$typeid)
|
|||||||
$c = new Categorie($db);
|
$c = new Categorie($db);
|
||||||
$cats = $c->containing($object->id,$typeid);
|
$cats = $c->containing($object->id,$typeid);
|
||||||
|
|
||||||
if (sizeof($cats) > 0)
|
if (count($cats) > 0)
|
||||||
{
|
{
|
||||||
if ($typeid == 0) $title=$langs->trans("ProductIsInCategories");
|
if ($typeid == 0) $title=$langs->trans("ProductIsInCategories");
|
||||||
if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories");
|
if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories");
|
||||||
@ -517,7 +522,7 @@ function formCategory($db,$object,$typeid)
|
|||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
else if($cats < 0)
|
else if ($cats < 0)
|
||||||
{
|
{
|
||||||
print $langs->trans("ErrorUnknown");
|
print $langs->trans("ErrorUnknown");
|
||||||
}
|
}
|
||||||
@ -530,6 +535,7 @@ function formCategory($db,$object,$typeid)
|
|||||||
print $title;
|
print $title;
|
||||||
print "<br/>";
|
print "<br/>";
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -500,10 +500,11 @@ class Categorie
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return list of contents of a category
|
* Return list of contents of a category
|
||||||
* \param field Field name for select in table. Full field name will be fk_field.
|
*
|
||||||
* \param class PHP Class of object to store entity
|
* @param field Field name for select in table. Full field name will be fk_field.
|
||||||
* \param table Table name for select in table. Full table name will be PREFIX_categorie_table.
|
* @param class PHP Class of object to store entity
|
||||||
|
* @param table Table name for select in table. Full table name will be PREFIX_categorie_table.
|
||||||
*/
|
*/
|
||||||
function get_type($field,$classname,$table='')
|
function get_type($field,$classname,$table='')
|
||||||
{
|
{
|
||||||
@ -565,15 +566,18 @@ class Categorie
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retourne la description d'une categorie
|
* Return category description
|
||||||
|
*
|
||||||
|
* @param $cate
|
||||||
|
* @return string Description
|
||||||
*/
|
*/
|
||||||
function get_desc ($cate)
|
function get_desc ($cate)
|
||||||
{
|
{
|
||||||
$sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie ";
|
$sql = "SELECT description FROM ".MAIN_DB_PREFIX."categorie ";
|
||||||
$sql .= "WHERE rowid = '".$cate."'";
|
$sql .= "WHERE rowid = '".$cate."'";
|
||||||
|
|
||||||
$res = $this->db->query ($sql);
|
$res = $this->db->query($sql);
|
||||||
$n = $this->db->fetch_array ($res);
|
$n = $this->db->fetch_array($res);
|
||||||
|
|
||||||
return ($n[0]);
|
return ($n[0]);
|
||||||
}
|
}
|
||||||
@ -961,7 +965,7 @@ class Categorie
|
|||||||
/**
|
/**
|
||||||
* print_primary_way() affiche le chemin le plus court pour se rendre a un produit
|
* print_primary_way() affiche le chemin le plus court pour se rendre a un produit
|
||||||
*/
|
*/
|
||||||
function print_primary_way($id, $sep= " >> ", $url, $type="")
|
function print_primary_way($id, $sep= " >> ", $url="", $type="")
|
||||||
{
|
{
|
||||||
$primary_way = Array();
|
$primary_way = Array();
|
||||||
$way = $this->get_primary_way($id,$type);
|
$way = $this->get_primary_way($id,$type);
|
||||||
@ -1073,8 +1077,14 @@ class Categorie
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne les categories dont l'id ou le nom correspond
|
* Retourne les categories dont l'id ou le nom correspond
|
||||||
* ajoute des wildcards au nom sauf si $exact = true
|
* ajoute des wildcards au nom sauf si $exact = true
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param nom
|
||||||
|
* @param type
|
||||||
|
* @param exact
|
||||||
|
* @return int or array
|
||||||
*/
|
*/
|
||||||
function rechercher($id, $nom, $type, $exact = false)
|
function rechercher($id, $nom, $type, $exact = false)
|
||||||
{
|
{
|
||||||
@ -1115,11 +1125,12 @@ class Categorie
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return name and link of category (with picto)
|
* Return name and link of category (with picto)
|
||||||
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
*
|
||||||
* \param option Sur quoi pointe le lien ('', 'xyz')
|
* @param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||||
* \param maxlength Max length of text
|
* @param option Sur quoi pointe le lien ('', 'xyz')
|
||||||
* \return string Chaine avec URL
|
* @param maxlength Max length of text
|
||||||
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0,$option='',$maxlength=0)
|
function getNomUrl($withpicto=0,$option='',$maxlength=0)
|
||||||
{
|
{
|
||||||
@ -1142,11 +1153,12 @@ class Categorie
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Deplace fichier uploade sous le nom $files dans le repertoire sdir
|
* Deplace fichier uploade sous le nom $files dans le repertoire sdir
|
||||||
* \param sdir Repertoire destination finale
|
*
|
||||||
* \param $file Nom du fichier uploade
|
* @param sdir Repertoire destination finale
|
||||||
* \param maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
* @param $file Nom du fichier uploade
|
||||||
* \param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
* @param maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||||
|
* @param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||||
*/
|
*/
|
||||||
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
||||||
{
|
{
|
||||||
@ -1194,10 +1206,11 @@ class Categorie
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne tableau de toutes les photos de la categorie
|
* Return tableau de toutes les photos de la categorie
|
||||||
* \param dir Repertoire a scanner
|
*
|
||||||
* \param nbmax Nombre maximum de photos (0=pas de max)
|
* @param dir Repertoire a scanner
|
||||||
* \return array Tableau de photos
|
* @param nbmax Nombre maximum de photos (0=pas de max)
|
||||||
|
* @return array Tableau de photos
|
||||||
*/
|
*/
|
||||||
function liste_photos($dir,$nbmax=0)
|
function liste_photos($dir,$nbmax=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -52,7 +52,7 @@ $result = restrictedArea($user, 'categorie', $id);
|
|||||||
// Action mise a jour d'une categorie
|
// Action mise a jour d'une categorie
|
||||||
if ($action == 'update' && $user->rights->categorie->creer)
|
if ($action == 'update' && $user->rights->categorie->creer)
|
||||||
{
|
{
|
||||||
$categorie = new Categorie ($db);
|
$categorie = new Categorie($db);
|
||||||
$result=$categorie->fetch($id);
|
$result=$categorie->fetch($id);
|
||||||
|
|
||||||
$categorie->label = $_POST["nom"];
|
$categorie->label = $_POST["nom"];
|
||||||
@ -112,7 +112,7 @@ if ($mesg)
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$categorie = new Categorie ($db, $id);
|
$categorie = new Categorie($db, $id);
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
print '<table class="notopnoleft" border="0" width="100%">';
|
print '<table class="notopnoleft" border="0" width="100%">';
|
||||||
@ -144,7 +144,7 @@ $doleditor->Create();
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Parent category
|
// Parent category
|
||||||
print '<tr><td>'.$langs->trans ("In").'</td><td>';
|
print '<tr><td>'.$langs->trans("In").'</td><td>';
|
||||||
print $html->select_all_categories($type,$categorie->id_mere,'catMere',64,$categorie->id);
|
print $html->select_all_categories($type,$categorie->id_mere,'catMere',64,$categorie->id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -215,7 +215,7 @@ if ($user->rights->categorie->creer)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Parent category
|
// Parent category
|
||||||
print '<tr><td>'.$langs->trans ("AddIn").'</td><td>';
|
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||||
print $html->select_all_categories($type,$catorigin);
|
print $html->select_all_categories($type,$catorigin);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ print '<tr class="liste_titre">';
|
|||||||
print '<td colspan="3">'.$langs->trans("Search").'</td>';
|
print '<td colspan="3">'.$langs->trans("Search").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '<tr '.$bc[0].'><td>';
|
print '<tr '.$bc[0].'><td>';
|
||||||
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="20" name="catname" value="' . $_POST['catname'] . '"/></td><td><input type="submit" class="button" value="'.$langs->trans ("Search").'"></td></tr>';
|
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="20" name="catname" value="' . $_POST['catname'] . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||||
/*
|
/*
|
||||||
// faire une rech dans une sous categorie uniquement
|
// faire une rech dans une sous categorie uniquement
|
||||||
print '<tr '.$bc[0].'><td>';
|
print '<tr '.$bc[0].'><td>';
|
||||||
|
|||||||
@ -28,47 +28,47 @@ require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
|||||||
if (!$user->rights->categorie->lire) accessforbidden();
|
if (!$user->rights->categorie->lire) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
llxHeader ("","",$langs->trans("Categories"));
|
llxHeader("","",$langs->trans("Categories"));
|
||||||
|
|
||||||
print_fiche_titre ($langs->trans ("CatList"));
|
print_fiche_titre($langs->trans("CatList"));
|
||||||
|
|
||||||
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
print '<table border="0" width="100%" class="notopnoleftnoright">';
|
||||||
|
|
||||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||||
|
|
||||||
$c = new Categorie ($db);
|
$c = new Categorie($db);
|
||||||
$cats = $c->get_all_categories ();
|
$cats = $c->get_all_categories();
|
||||||
|
|
||||||
|
|
||||||
if ($cats != -1)
|
if ($cats != -1)
|
||||||
{
|
{
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Ref").'</td>';
|
print '<td>'.$langs->trans("Ref").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Type").'</td>';
|
print '<td align="right">'.$langs->trans("Type").'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
foreach ($cats as $cat)
|
foreach ($cats as $cat)
|
||||||
{
|
{
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
print "\t<tr ".$bc[$var].">\n";
|
print "\t<tr ".$bc[$var].">\n";
|
||||||
print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n";
|
print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n";
|
||||||
print "\t\t<td>".dol_trunc($cat->description,36)."</td>\n";
|
print "\t\t<td>".dol_trunc($cat->description,36)."</td>\n";
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($cat->type == 0) print $langs->trans("Product");
|
if ($cat->type == 0) print $langs->trans("Product");
|
||||||
elseif ($cat->type == 1) print $langs->trans("Supplier");
|
elseif ($cat->type == 1) print $langs->trans("Supplier");
|
||||||
elseif ($cat->type == 2) print $langs->trans("Customer");
|
elseif ($cat->type == 2) print $langs->trans("Customer");
|
||||||
else print $cat->type;
|
else print $cat->type;
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "\t</tr>\n";
|
print "\t</tr>\n";
|
||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error();
|
dol_print_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|||||||
@ -43,8 +43,8 @@ $confirm=GETPOST('confirm');
|
|||||||
|
|
||||||
if ($id == "")
|
if ($id == "")
|
||||||
{
|
{
|
||||||
dol_print_error('','Missing parameter id');
|
dol_print_error('','Missing parameter id');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -58,22 +58,22 @@ $object = new Categorie($db);
|
|||||||
|
|
||||||
if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
$result = $object->add_photo($conf->categorie->dir_output, $_FILES['userfile']);
|
$result = $object->add_photo($conf->categorie->dir_output, $_FILES['userfile']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer)
|
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer)
|
||||||
{
|
{
|
||||||
$object->delete_photo($conf->categorie->dir_output."/".$_GET["file"]);
|
$object->delete_photo($conf->categorie->dir_output."/".$_GET["file"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'addthumb' && $_GET["file"])
|
if ($action == 'addthumb' && $_GET["file"])
|
||||||
{
|
{
|
||||||
$object->add_thumb($conf->categorie->dir_output."/".$_GET["file"]);
|
$object->add_thumb($conf->categorie->dir_output."/".$_GET["file"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,223 +81,223 @@ if ($action == 'addthumb' && $_GET["file"])
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader ("","",$langs->trans("Categories"));
|
llxHeader("","",$langs->trans("Categories"));
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
if (!empty($id) || !empty($ref))
|
if (!empty($id) || !empty($ref))
|
||||||
{
|
{
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$title=$langs->trans("ProductsCategoryShort");
|
$title=$langs->trans("ProductsCategoryShort");
|
||||||
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
|
if ($type == 0) $title=$langs->trans("ProductsCategoryShort");
|
||||||
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
|
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort");
|
||||||
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
|
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort");
|
||||||
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort");
|
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort");
|
||||||
|
|
||||||
$head = categories_prepare_head($object,$type);
|
$head = categories_prepare_head($object,$type);
|
||||||
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
dol_fiche_head($head, 'photos', $title, 0, 'category');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression de photo
|
* Confirmation de la suppression de photo
|
||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print($mesg);
|
print($mesg);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Path of category
|
// Path of category
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
$ways = $object->print_all_ways ();
|
$ways = $object->print_all_ways();
|
||||||
print $langs->trans("Ref").'</td><td>';
|
print $langs->trans("Ref").'</td><td>';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||||
foreach ($ways as $way)
|
foreach ($ways as $way)
|
||||||
{
|
{
|
||||||
print $way."<br>\n";
|
print $way."<br>\n";
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
print $langs->trans("Description").'</td><td>';
|
print $langs->trans("Description").'</td><td>';
|
||||||
print nl2br($object->description);
|
print nl2br($object->description);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Visibility
|
// Visibility
|
||||||
/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
/* if ($type == 0 && $conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER)
|
||||||
{
|
{
|
||||||
if ($object->socid)
|
if ($object->socid)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$soc->fetch($object->socid);
|
$soc->fetch($object->socid);
|
||||||
|
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
print $langs->trans("AssignedToTheCustomer").'</td><td>';
|
||||||
print $soc->getNomUrl(1);
|
print $soc->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
$catsMeres = $object->get_meres ();
|
$catsMeres = $object->get_meres ();
|
||||||
|
|
||||||
if ($catsMeres < 0)
|
if ($catsMeres < 0)
|
||||||
{
|
{
|
||||||
dol_print_error();
|
dol_print_error();
|
||||||
}
|
}
|
||||||
else if (count($catsMeres) > 0)
|
else if (count($catsMeres) > 0)
|
||||||
{
|
{
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
print $langs->trans("CategoryContents").'</td><td>';
|
print $langs->trans("CategoryContents").'</td><td>';
|
||||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
print $langs->trans("CategoryContents").'</td><td>';
|
print $langs->trans("CategoryContents").'</td><td>';
|
||||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
print $langs->trans("CategoryContents").'</td><td>';
|
print $langs->trans("CategoryContents").'</td><td>';
|
||||||
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Barre d'action */
|
/* Barre d'action */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
print "\n<div class=\"tabsAction\">\n";
|
print "\n<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if ($action != 'ajout_photo' && $user->rights->produit->creer)
|
if ($action != 'ajout_photo' && $user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/photos.php?action=ajout_photo&id='.$object->id.'&type='.$type.'">';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/categories/photos.php?action=ajout_photo&id='.$object->id.'&type='.$type.'">';
|
||||||
print $langs->trans("AddPhoto").'</a>';
|
print $langs->trans("AddPhoto").'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#">';
|
print '<a class="butActionRefused" href="#">';
|
||||||
print $langs->trans("AddPhoto").'</a>';
|
print $langs->trans("AddPhoto").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une photo
|
* Ajouter une photo
|
||||||
*/
|
*/
|
||||||
if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
if ($action == 'ajout_photo' && $user->rights->categorie->creer && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
// Affiche formulaire upload
|
// Affiche formulaire upload
|
||||||
$formfile=new FormFile($db);
|
$formfile=new FormFile($db);
|
||||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1);
|
$formfile->form_attach_new_file(DOL_URL_ROOT.'/categories/photos.php?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche photos
|
// Affiche photos
|
||||||
if ($action != 'ajout_photo')
|
if ($action != 'ajout_photo')
|
||||||
{
|
{
|
||||||
$nbphoto=0;
|
$nbphoto=0;
|
||||||
$nbbyrow=5;
|
$nbbyrow=5;
|
||||||
|
|
||||||
$maxWidth = 160;
|
$maxWidth = 160;
|
||||||
$maxHeight = 120;
|
$maxHeight = 120;
|
||||||
|
|
||||||
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
|
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
|
||||||
$dir = $conf->categorie->dir_output.'/'.$pdir;
|
$dir = $conf->categorie->dir_output.'/'.$pdir;
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||||
|
|
||||||
foreach ($object->liste_photos($dir) as $key => $obj)
|
foreach ($object->liste_photos($dir) as $key => $obj)
|
||||||
{
|
{
|
||||||
$nbphoto++;
|
$nbphoto++;
|
||||||
|
|
||||||
|
|
||||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||||
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||||
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=categorie&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=categorie&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||||
|
|
||||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||||
if ($obj['photo_vignette'])
|
if ($obj['photo_vignette'])
|
||||||
{
|
{
|
||||||
$filename='thumbs/'.$obj['photo_vignette'];
|
$filename='thumbs/'.$obj['photo_vignette'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$filename=$obj['photo'];
|
$filename=$obj['photo'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nom affiche
|
// Nom affiche
|
||||||
$viewfilename=$obj['photo'];
|
$viewfilename=$obj['photo'];
|
||||||
|
|
||||||
// Taille de l'image
|
// Taille de l'image
|
||||||
$object->get_image_size($dir.$filename);
|
$object->get_image_size($dir.$filename);
|
||||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||||
|
|
||||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=categorie&file='.urlencode($pdir.$filename).'">';
|
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=categorie&file='.urlencode($pdir.$filename).'">';
|
||||||
|
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '<br>'.$viewfilename;
|
print '<br>'.$viewfilename;
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||||
}
|
}
|
||||||
if ($user->rights->categorie->creer)
|
if ($user->rights->categorie->creer)
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||||
print img_delete().'</a>';
|
print img_delete().'</a>';
|
||||||
}
|
}
|
||||||
if ($nbbyrow) print '</td>';
|
if ($nbbyrow) print '</td>';
|
||||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ferme tableau
|
// Ferme tableau
|
||||||
while ($nbphoto % $nbbyrow)
|
while ($nbphoto % $nbbyrow)
|
||||||
{
|
{
|
||||||
print '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
print '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||||
$nbphoto++;
|
$nbphoto++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nbphoto < 1)
|
if ($nbphoto < 1)
|
||||||
{
|
{
|
||||||
print '<tr align=center valign=middle border=1><td class="photo">';
|
print '<tr align=center valign=middle border=1><td class="photo">';
|
||||||
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
|
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("ErrorUnknown");
|
print $langs->trans("ErrorUnknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
|||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
llxHeader ("","",$langs->trans("Categories"));
|
llxHeader("","",$langs->trans("Categories"));
|
||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ print '<table border="0" width="100%" class="border">';
|
|||||||
|
|
||||||
// Path of category
|
// Path of category
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
$ways = $object->print_all_ways ();
|
$ways = $object->print_all_ways();
|
||||||
print $langs->trans("Ref").'</td><td>';
|
print $langs->trans("Ref").'</td><td>';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||||
foreach ($ways as $way)
|
foreach ($ways as $way)
|
||||||
@ -168,7 +168,7 @@ else
|
|||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
if (sizeof ($cats) > 0)
|
if (count($cats) > 0)
|
||||||
{
|
{
|
||||||
$var=true;
|
$var=true;
|
||||||
foreach ($cats as $cat)
|
foreach ($cats as $cat)
|
||||||
@ -217,7 +217,7 @@ if ($object->type == 0)
|
|||||||
print "<table class='noborder' width='100%'>\n";
|
print "<table class='noborder' width='100%'>\n";
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
||||||
|
|
||||||
if (sizeof ($prods) > 0)
|
if (count($prods) > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
$var=true;
|
||||||
@ -255,7 +255,7 @@ if ($object->type == 1)
|
|||||||
print "<table class='noborder' width='100%'>\n";
|
print "<table class='noborder' width='100%'>\n";
|
||||||
print "<tr class='liste_titre'><td>".$langs->trans("Suppliers")."</td></tr>\n";
|
print "<tr class='liste_titre'><td>".$langs->trans("Suppliers")."</td></tr>\n";
|
||||||
|
|
||||||
if (sizeof ($socs) > 0)
|
if (count($socs) > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
$var=true;
|
||||||
@ -274,7 +274,7 @@ if ($object->type == 1)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr ".$bc[false]."><td>".$langs->trans ("ThisCategoryHasNoSupplier")."</td></tr>";
|
print "<tr ".$bc[false]."><td>".$langs->trans("ThisCategoryHasNoSupplier")."</td></tr>";
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ if($object->type == 2)
|
|||||||
print "<table class='noborder' width='100%'>\n";
|
print "<table class='noborder' width='100%'>\n";
|
||||||
print "<tr class='liste_titre'><td>".$langs->trans("Customers")."</td></tr>\n";
|
print "<tr class='liste_titre'><td>".$langs->trans("Customers")."</td></tr>\n";
|
||||||
|
|
||||||
if (sizeof ($socs) > 0)
|
if (count($socs) > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
$var=true;
|
||||||
@ -333,7 +333,7 @@ if ($object->type == 3)
|
|||||||
print "<table class='noborder' width='100%'>\n";
|
print "<table class='noborder' width='100%'>\n";
|
||||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Member")."</td></tr>\n";
|
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Member")."</td></tr>\n";
|
||||||
|
|
||||||
if (sizeof ($prods) > 0)
|
if (count($prods) > 0)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user