Qual: Uniformize code for links
This commit is contained in:
parent
9a2e9d9c5c
commit
19ee6583ce
@ -26,6 +26,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
|
||||||
|
|
||||||
$langs->load("products");
|
$langs->load("products");
|
||||||
$langs->load("suppliers");
|
$langs->load("suppliers");
|
||||||
@ -65,11 +67,16 @@ if (isset($_REQUEST['catid']))
|
|||||||
$catid = $_REQUEST['catid'];
|
$catid = $_REQUEST['catid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mode Liste
|
* Mode Liste
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$productstatic = new Product($db);
|
||||||
|
$companystatic = new Societe($db);
|
||||||
|
|
||||||
$title=$langs->trans("ProductsAndServices");
|
$title=$langs->trans("ProductsAndServices");
|
||||||
|
|
||||||
if ($fourn_id)
|
if ($fourn_id)
|
||||||
@ -78,10 +85,10 @@ if ($fourn_id)
|
|||||||
$supplier->fetch($fourn_id);
|
$supplier->fetch($fourn_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type";
|
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type,";
|
||||||
$sql .= ", pf.fk_soc, pf.ref_fourn";
|
$sql .= " pf.fk_soc, pf.ref_fourn,";
|
||||||
$sql .= ", min(ppf.price) as price";
|
$sql .= " ppf.price as price, ppf.quantity as qty,";
|
||||||
$sql .= ", s.nom";
|
$sql .= " s.rowid as socid, s.nom";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($catid)
|
if ($catid)
|
||||||
{
|
{
|
||||||
@ -89,7 +96,7 @@ if ($catid)
|
|||||||
}
|
}
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = pf.fk_soc";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = pf.fk_soc";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON ppf.fk_product_fournisseur = pf.rowid AND ppf.quantity = 1";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON ppf.fk_product_fournisseur = pf.rowid";
|
||||||
|
|
||||||
if ($_POST["mode"] == 'search')
|
if ($_POST["mode"] == 'search')
|
||||||
{
|
{
|
||||||
@ -125,12 +132,11 @@ if ($fourn_id > 0)
|
|||||||
{
|
{
|
||||||
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY p.rowid";
|
$sql .= " ORDER BY ".$sortfield." ".$sortorder;
|
||||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
|
||||||
$sql .= $db->plimit($limit + 1 ,$offset);
|
$sql .= $db->plimit($limit + 1 ,$offset);
|
||||||
|
|
||||||
|
|
||||||
dolibarr_syslog("fourn/product/liste: sql=$sql");
|
dolibarr_syslog("fourn/product/liste: sql=".$sql);
|
||||||
|
|
||||||
$resql = $db->query($sql) ;
|
$resql = $db->query($sql) ;
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -175,6 +181,7 @@ if ($resql)
|
|||||||
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Label"),"liste.php", "p.label",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Supplier"),"liste.php", "pf.fk_soc",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Supplier"),"liste.php", "pf.fk_soc",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("BuyingPrice"),"liste.php", "ppf.price",$param,"",'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("BuyingPrice"),"liste.php", "ppf.price",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("QtyMin"),"liste.php", "ppf.qty",$param,"",'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
@ -185,15 +192,15 @@ if ($resql)
|
|||||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="sref" value="'.$sref.'">';
|
print '<input class="flat" type="text" name="sref" value="'.$sref.'" size="12">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="srefsupplier" value="'.$sRefSupplier.'">';
|
print '<input class="flat" type="text" name="srefsupplier" value="'.$sRefSupplier.'" size="12">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre" colspan="2" align="right">';
|
print '<td class="liste_titre" colspan="3" align="right">';
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||||
print ' <input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
|
print ' <input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -208,24 +215,25 @@ if ($resql)
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
if ($oldid <> $objp->rowid)
|
print '<td>';
|
||||||
{
|
$productstatic->id=$objp->rowid;
|
||||||
$oldid = $objp->rowid;
|
$productstatic->ref=$objp->ref;
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->rowid.'">';
|
$productstatic->type=$objp->fk_product_type;
|
||||||
if ($objp->fk_product_type==1) print img_object($langs->trans("ShowService"),"service");
|
print $productstatic->getNomUrl(1,'supplier');
|
||||||
else print img_object($langs->trans("ShowProduct"),"product");
|
print '</td>';
|
||||||
print "</a> ";
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->rowid.'">'.$objp->ref.'</a></td>';
|
print '<td>'.$objp->ref_fourn.'</td>';
|
||||||
print '<td>'.$objp->ref_fourn.'</td>';
|
|
||||||
print '<td>'.$objp->label.'</td>'."\n";
|
print '<td>'.$objp->label.'</td>'."\n";
|
||||||
}
|
|
||||||
else
|
$companystatic->nom=$objp->nom;
|
||||||
{
|
$companystatic->id=$objp->socid;
|
||||||
print '<td colspan="2"> </td>';
|
print '<td>'.$companystatic->getNomUrl(1,'supplier').'</td>';
|
||||||
}
|
|
||||||
|
|
||||||
print '<td>'.$objp->nom.'</td>';
|
|
||||||
print '<td align="right">'.price($objp->price).'</td>';
|
print '<td align="right">'.price($objp->price).'</td>';
|
||||||
|
|
||||||
|
print '<td align="right">'.$objp->qty.'</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2096,8 +2096,16 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$result='';
|
$result='';
|
||||||
|
|
||||||
$lien = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">';
|
if ($option == 'supplier')
|
||||||
$lienfin='</a>';
|
{
|
||||||
|
$lien = '<a href="'.DOL_URL_ROOT.'/product/fournisseurs.php?id='.$this->id.'">';
|
||||||
|
$lienfin='</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lien = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">';
|
||||||
|
$lienfin='</a>';
|
||||||
|
}
|
||||||
$newref=$this->ref;
|
$newref=$this->ref;
|
||||||
if ($maxlength) $newref=dolibarr_trunc($newref,$maxlength,'middle');
|
if ($maxlength) $newref=dolibarr_trunc($newref,$maxlength,'middle');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user