2
0
forked from Wavyzz/dolibarr

task #5005 overview: Ajout bouton "suivant" et "prcdent" dans un fiche produit

This commit is contained in:
Laurent Destailleur
2005-12-03 03:49:00 +00:00
parent 4421ae8ea0
commit b8dbecd20d
16 changed files with 290 additions and 102 deletions

View File

@@ -219,21 +219,25 @@ function dolibarr_syslog($message, $level=LOG_ERR)
/** /**
\brief Affiche le header d'une fiche \brief Affiche le header d'une fiche
\param links liens \param links Tableau de titre d'onglets
\param active 0 par d<>faut \param active 0=onglet non actif, 1=onglet actif
\param title titre ("" par defaut) \param title Titre tabelau ("" par defaut)
*/ */
function dolibarr_fiche_head($links, $active=0, $title='') function dolibarr_fiche_head($links, $active=0, $title='')
{ {
print '<div class="tabs">'."\n"; print '<div class="tabs">'."\n";
if (strlen($title)) // Affichage titre
if ($title)
{ {
$limittitle=30; $limittitle=30;
if (strlen($title) > $limittitle) print '<a class="tabTitle">'.substr($title,0,$limittitle).'...</a>'; print '<a class="tabTitle">';
else print '<a class="tabTitle">'.$title.'</a>'; if (strlen($title) > $limittitle) print substr($title,0,$limittitle).'...';
else print $title;
print '</a>';
} }
// Affichage onglets
for ($i = 0 ; $i < sizeof($links) ; $i++) for ($i = 0 ; $i < sizeof($links) ; $i++)
{ {
if ($links[$i][2] == 'image') if ($links[$i][2] == 'image')
@@ -254,6 +258,7 @@ function dolibarr_fiche_head($links, $active=0, $title='')
} }
print "</div>\n"; print "</div>\n";
print '<div class="tabBar">'."\n\n"; print '<div class="tabBar">'."\n\n";
} }

View File

@@ -179,6 +179,31 @@ class DoliDb
return $this->db; return $this->db;
} }
/**
\brief Renvoie la version du serveur
\return string Chaine version
*/
function getVersion()
{
$resql=$this->query('SELECT VERSION()');
$row=$this->fetch_row($resql);
return $row[0];
}
/**
\brief Renvoie l'id de la connection
\return string Id connection
*/
function getConnectId()
{
$resql=$this->query('SELECT CONNECTION_ID()');
$row=$this->fetch_row($resql);
return $row[0];
}
/** /**
\brief Cr<43>ation d'une nouvelle base de donn<6E>e \brief Cr<43>ation d'une nouvelle base de donn<6E>e
\param database nom de la database <20> cr<63>er \param database nom de la database <20> cr<63>er

View File

@@ -405,16 +405,28 @@ class Product
/** /**
* \brief Charge le produit/service en m<>moire * \brief Charge le produit/service en m<>moire
* \param id id du produit/service <20> charger * \param id Id du produit/service <20> charger
* \param ref Ref du produit/service <20> charger
* \return int <0 si ko, >0 si ok
*/ */
function fetch ($id) function fetch($id='',$ref='')
{ {
global $langs;
// Verification parametres
if (! $id && ! $ref)
{
$this->error=$langs->trans('ErrorWrongParameters');
return -1;
}
$sql = "SELECT rowid, ref, label, description, note, price, tva_tx, envente,"; $sql = "SELECT rowid, ref, label, description, note, price, tva_tx, envente,";
$sql.= " nbvente, fk_product_type, duration, seuil_stock_alerte"; $sql.= " nbvente, fk_product_type, duration, seuil_stock_alerte";
$sql.= " FROM ".MAIN_DB_PREFIX."product WHERE rowid = $id"; $sql.= " FROM ".MAIN_DB_PREFIX."product";
if ($id) $sql.= " WHERE rowid = ".$id;
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if ( $result ) if ( $result )
{ {
$result = $this->db->fetch_array(); $result = $this->db->fetch_array();
@@ -451,7 +463,7 @@ class Product
$this->db->free(); $this->db->free();
$sql = "SELECT reel, fk_entrepot"; $sql = "SELECT reel, fk_entrepot";
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product = ".$id; $sql .= " FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product = ".$this->id;
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if ($result) if ($result)
{ {
@@ -491,6 +503,43 @@ class Product
} }
/**
* \brief Charge les propri<72>t<EFBFBD>s ref_previous et ref_next
* \param filter filtre
* \return int <0 si ko, >0 si ok
*/
function load_previous_next_ref($filtre='')
{
$sql = "SELECT MAX(ref)";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE ref < '".addslashes($this->ref)."'";
if ($filter) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -1;
}
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
$sql = "SELECT MIN(ref)";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE ref > '".addslashes($this->ref)."'";
if ($filter) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -2;
}
$row = $this->db->fetch_row($result);
$this->ref_next = $row[0];
return 1;
}
/** /**
* \brief Charge tableau des stats propale pour le produit/service * \brief Charge tableau des stats propale pour le produit/service
* \param socid Id societe * \param socid Id societe

View File

@@ -50,7 +50,8 @@ $types[1] = $langs->trans("Service");
llxHeader("","",$langs->trans("BarCode")); llxHeader("","",$langs->trans("BarCode"));
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
$h=0; $h=0;
@@ -120,9 +121,20 @@ $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference
print '<tr>'; print '<tr>';
print '<td width="10%">'.$langs->trans("Ref").'</td><td colspan="2" width="40%">'.$product->ref.'</td>'; print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>'; print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
print '</tr>'; print '</tr>';

View File

@@ -38,20 +38,23 @@ $user->getrights('produit');
if (!$user->rights->produit->lire) if (!$user->rights->produit->lire)
accessforbidden(); accessforbidden();
$productid=empty($_GET['id']) ? 0 : intVal($_GET['id']);
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; $action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action'];
if ($productid > 0)
$product = new Product($db);
if ($_GET['id'] || $_GET["ref"])
{ {
$product = new Product($db); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($product->fetch($productid)) if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
$prodref = sanitize_string($product->ref); $prodref = sanitize_string($product->ref);
$upload_dir = $conf->produit->dir_output.'/'.$prodref; $upload_dir = $conf->produit->dir_output.'/'.$prodref;
} }
/* /*
* Action envoie fichier * Action envoie fichier
*/ */
if ( $_POST["sendit"] && $conf->upload) if ($_POST["sendit"] && $conf->upload)
{ {
/* /*
* Creation r<>pertoire si n'existe pas * Creation r<>pertoire si n'existe pas
@@ -79,7 +82,7 @@ if ( $_POST["sendit"] && $conf->upload)
llxHeader(); llxHeader();
if ($productid > 0) if ($product->id)
{ {
if ( $error_msg ) if ( $error_msg )
{ {
@@ -157,7 +160,8 @@ if ($productid > 0)
$hselected=$h; $hselected=$h;
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); $titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, $hselected, $titre);
// Construit liste des fichiers // Construit liste des fichiers
clearstatcache(); clearstatcache();
@@ -188,9 +192,23 @@ if ($productid > 0)
// print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>'; // print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>';
} }
print '<table class="border"width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$product->ref.'</td></tr>';
print '<tr><td width="30%">'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>'; // Reference
print '<tr>';
print '<td width="28%">'.$langs->trans("Ref").'</td><td colspan="3">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>'; print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
@@ -263,7 +281,6 @@ if ($productid > 0)
} }
print '</table>'; print '</table>';
print '</div>';
} }
else else
{ {

View File

@@ -44,6 +44,7 @@ if (!$user->rights->produit->lire) accessforbidden();
$types[0] = $langs->trans("Product"); $types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service"); $types[1] = $langs->trans("Service");
/* /*
* *
*/ */
@@ -53,6 +54,7 @@ if ($_GET["action"] == 'fastappro')
$product->fetch($_GET["id"]); $product->fetch($_GET["id"]);
$result = $product->fastappro($user); $result = $product->fastappro($user);
Header("Location: fiche.php?id=".$_GET["id"]); Header("Location: fiche.php?id=".$_GET["id"]);
exit;
} }
@@ -80,6 +82,7 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
if ($id > 0) if ($id > 0)
{ {
Header("Location: fiche.php?id=$id"); Header("Location: fiche.php?id=$id");
exit;
} }
else else
{ {
@@ -158,6 +161,8 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
$db->commit(); $db->commit();
Header("Location: fiche.php?id=$id"); Header("Location: fiche.php?id=$id");
$db->close();
exit;
} }
else if ($id == -3) else if ($id == -3)
{ {
@@ -334,13 +339,14 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
/* /*
* Fiche produit * Fiche produit
*/ */
if ($_GET["id"]) if ($_GET["id"] || $_GET["ref"])
{ {
if ($_GET["action"] <> 're-edit') if ($_GET["action"] <> 're-edit')
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
} }
if ( $result ) if ( $result )
@@ -416,7 +422,10 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
$titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, $hselected, $titre);
print($mesg); print($mesg);
@@ -429,7 +438,14 @@ if ($_GET["id"])
if ($product->type == 1) $nblignes++; if ($product->type == 1) $nblignes++;
// Reference // Reference
print '<td width="15%">'.$langs->trans("Ref").'</td><td>'.$product->ref.'</td>'; print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
if ($product->is_photo_available($conf->produit->dir_output)) if ($product->is_photo_available($conf->produit->dir_output))
{ {
@@ -441,7 +457,7 @@ if ($_GET["id"])
print '</tr>'; print '</tr>';
// Libell<EFBFBD> // Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
print '</tr>'; print '</tr>';

View File

@@ -137,13 +137,13 @@ llxHeader("","",$langs->trans("CardProduct".$product->type));
/* /*
* Fiche produit * Fiche produit
*/ */
if ($_GET["id"]) if ($_GET["id"] || $_GET["ref"])
{ {
if ($_GET["action"] <> 're-edit') if ($_GET["action"] <> 're-edit')
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
} }
if ( $result ) if ( $result )
@@ -230,11 +230,27 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); $titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, $hselected, $titre);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">'.$product->ref.'</td></tr>';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td></tr>';
// Prix
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">'.price($product->price).'</td></tr>'; print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="2">'.price($product->price).'</td></tr>';
// Statut // Statut

View File

@@ -52,7 +52,7 @@ $types[1] = $langs->trans("Service");
* Actions * Actions
*/ */
if ($_POST["sendit"] && defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1) if ($_POST["sendit"] && $conf->global->MAIN_UPLOAD_DOC)
{ {
if ($_GET["id"]) if ($_GET["id"])
{ {
@@ -80,11 +80,12 @@ if ($_GET["action"] == 'delete' && $_GET["file"])
llxHeader("","",$langs->trans("CardProduct0")); llxHeader("","",$langs->trans("CardProduct0"));
if ($_GET["id"]) if ($_GET["id"] || $_GET["ref"])
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
if ($result) if ($result)
{ {
@@ -157,14 +158,26 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); $titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, $hselected, $titre);
print($mesg); print($mesg);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference
print '<tr>'; print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">'.$product->ref.'</td>'; print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>'; print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
print '</tr>'; print '</tr>';

View File

@@ -80,7 +80,8 @@ if ($_POST["action"] == 'update_price' &&
llxHeader("","",$langs->trans("Price")); llxHeader("","",$langs->trans("Price"));
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
$h=0; $h=0;
@@ -146,12 +147,24 @@ $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); $titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, $hselected, $titre);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference
print '<tr>'; print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">'.$product->ref.'</td>'; print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>'; print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
print '</tr>'; print '</tr>';

View File

@@ -47,16 +47,12 @@ $pagenext = $_GET["page"] + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.datef"; if (! $sortfield) $sortfield="f.datef";
// Securite
$socid = 0;
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
else
{
$socid = 0;
}
/* /*
@@ -67,10 +63,11 @@ else
llxHeader(); llxHeader();
if ($_GET["id"]) if ($_GET["id"] || $_GET["ref"])
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
if ($result > 0) if ($result > 0)
{ {
@@ -101,7 +98,6 @@ if ($_GET["id"])
} }
} }
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
$head[$h][1] = $langs->trans("Photos"); $head[$h][1] = $langs->trans("Photos");
$h++; $h++;
@@ -143,14 +139,24 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); $titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, $hselected, $titre);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference
print '<tr>'; print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="3">'.$product->ref.'</td>'; print '<td width="28%">'.$langs->trans("Ref").'</td><td colspan="3">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>'; print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td>';
print '</tr>'; print '</tr>';
@@ -163,10 +169,10 @@ if ($_GET["id"])
else print $langs->trans("NotOnSell"); else print $langs->trans("NotOnSell");
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>'; print '<tr><td valign="top" width="28%">'.$langs->trans("Referers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfCustomers").'</td>'; print '<td align="right" width="24%">'.$langs->trans("NbOfCustomers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>'; print '<td align="right" width="24%">'.$langs->trans("NbOfReferers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>'; print '<td align="right" width="24%">'.$langs->trans("TotalQuantity").'</td>';
print '</tr>'; print '</tr>';
// Propals // Propals

View File

@@ -58,11 +58,11 @@ $mesg = '';
/* /*
* *
*/ */
if ($_GET["id"] || $_GET["ref"])
if ($_GET["id"])
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
if ($result) if ($result)
{ {
@@ -187,13 +187,24 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$h++; $h++;
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); $titre=$langs->trans("CardProduct".$product->type);
dolibarr_fiche_head($head, $hselected, $titre);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference
print '<tr>'; print '<tr>';
print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$product->ref.'</td>'; print '<td width="28%">'.$langs->trans("Ref").'</td><td colspan="3">';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>'; print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>';
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="3">'.price($product->price).'</td>'; print '<tr><td>'.$langs->trans("SellingPrice").'</td><td colspan="3">'.price($product->price).'</td>';
@@ -204,10 +215,10 @@ if ($_GET["id"])
else print $langs->trans("NotOnSell"); else print $langs->trans("NotOnSell");
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top" width="25%">'.$langs->trans("Referers").'</td>'; print '<tr><td valign="top" width="28%">'.$langs->trans("Referers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfCustomers").'</td>'; print '<td align="right" width="24%">'.$langs->trans("NbOfCustomers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("NbOfReferers").'</td>'; print '<td align="right" width="24%">'.$langs->trans("NbOfReferers").'</td>';
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>'; print '<td align="right" width="24%">'.$langs->trans("TotalQuantity").'</td>';
print '</tr>'; print '</tr>';
// Propals // Propals

View File

@@ -98,12 +98,13 @@ if ($_POST["action"] == "transfert_stock" && $_POST["cancel"] <> $langs->trans("
* Fiche stock * Fiche stock
* *
*/ */
if ($_GET["id"]) if ($_GET["id"] || $_GET["ref"])
{ {
$product = new Product($db); $product = new Product($db);
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
if ( $product->fetch($_GET["id"])) if ($result > 0)
{ {
$h=0; $h=0;
@@ -175,7 +176,14 @@ if ($_GET["id"])
// Reference // Reference
print '<tr>'; print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td>'.$product->ref.'</td>'; print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
$product->load_previous_next_ref();
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':'';
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':'';
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>';
if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>';
print '</td>';
print '</tr>'; print '</tr>';
// Libell<6C> // Libell<6C>
@@ -194,7 +202,7 @@ if ($_GET["id"])
// TVA // TVA
$langs->load("bills"); $langs->load("bills");
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.$product->tva_tx.' %</td></tr>'; print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.$product->tva_tx.'%</td></tr>';
// Stock // Stock
if ($product->type == 0 && $conf->stock->enabled) if ($product->type == 0 && $conf->stock->enabled)
@@ -222,7 +230,6 @@ if ($_GET["id"])
/* /*
* Contenu des stocks * Contenu des stocks
*
*/ */
print '<br><table class="noborder" width="100%">'; print '<br><table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="40%">'.$langs->trans("Warehouse").'</td><td width="60%">Valeur du stock</td></tr>'; print '<tr class="liste_titre"><td width="40%">'.$langs->trans("Warehouse").'</td><td width="60%">Valeur du stock</td></tr>';
@@ -250,7 +257,6 @@ if ($_GET["id"])
/* /*
* Correction du stock * Correction du stock
*
*/ */
if ($_GET["action"] == "correction") if ($_GET["action"] == "correction")
{ {
@@ -288,9 +294,9 @@ if ($_GET["id"])
print '</form>'; print '</form>';
} }
/* /*
* Transfert de pi<70>ces * Transfert de pi<70>ces
*
*/ */
if ($_GET["action"] == "transfert") if ($_GET["action"] == "transfert")
{ {
@@ -344,13 +350,13 @@ if ($_GET["id"])
print '</form>'; print '</form>';
} }
/* /*
* *
*
*/ */
if ($_GET["action"] == "definir") if ($_GET["action"] == "definir")
{ {
print_titre ("Cr<EFBFBD>er un stock"); print_titre($langs->trans("SetStock"));
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n"; print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
print '<input type="hidden" name="action" value="create_stock">'; print '<input type="hidden" name="action" value="create_stock">';
print '<table class="border" width="100%"><tr>'; print '<table class="border" width="100%"><tr>';

View File

@@ -401,10 +401,9 @@ a.tabTitle {
color: white; color: white;
font-weight: normal; font-weight: normal;
padding: 0px 6px; padding: 0px 6px;
margin: 0em 0.5em; margin: 0px 6px;
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;
border-right: 1px solid #555555; border-right: 1px solid #555555;
border-left: 1px solid #D8D8D8; border-left: 1px solid #D8D8D8;
border-top: 1px solid #D8D8D8; border-top: 1px solid #D8D8D8;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 784 B

After

Width:  |  Height:  |  Size: 1.2 KiB