38 |
if (!$user->rights->produit->lire) |
if (!$user->rights->produit->lire) |
39 |
accessforbidden(); |
accessforbidden(); |
40 |
|
|
|
$productid=empty($_GET['id']) ? 0 : intVal($_GET['id']); |
|
41 |
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; |
$action=empty($_GET['action']) ? (empty($_POST['action']) ? '' : $_POST['action']) : $_GET['action']; |
42 |
if ($productid > 0) |
|
43 |
|
$product = new Product($db); |
44 |
|
if ($_GET['id'] || $_GET["ref"]) |
45 |
{ |
{ |
46 |
$product = new Product($db); |
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); |
47 |
if ($product->fetch($productid)) |
if ($_GET["id"]) $result = $product->fetch($_GET["id"]); |
48 |
|
|
49 |
$prodref = sanitize_string($product->ref); |
$prodref = sanitize_string($product->ref); |
50 |
$upload_dir = $conf->produit->dir_output.'/'.$prodref; |
$upload_dir = $conf->produit->dir_output.'/'.$prodref; |
51 |
} |
} |
52 |
|
|
53 |
|
|
54 |
/* |
/* |
55 |
* Action envoie fichier |
* Action envoie fichier |
56 |
*/ |
*/ |
57 |
if ( $_POST["sendit"] && $conf->upload) |
if ($_POST["sendit"] && $conf->upload) |
58 |
{ |
{ |
59 |
/* |
/* |
60 |
* Creation répertoire si n'existe pas |
* Creation répertoire si n'existe pas |
82 |
llxHeader(); |
llxHeader(); |
83 |
|
|
84 |
|
|
85 |
if ($productid > 0) |
if ($product->id) |
86 |
{ |
{ |
87 |
if ( $error_msg ) |
if ( $error_msg ) |
88 |
{ |
{ |
160 |
$hselected=$h; |
$hselected=$h; |
161 |
$h++; |
$h++; |
162 |
|
|
163 |
dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); |
$titre=$langs->trans("CardProduct".$product->type); |
164 |
|
dolibarr_fiche_head($head, $hselected, $titre); |
165 |
|
|
166 |
// Construit liste des fichiers |
// Construit liste des fichiers |
167 |
clearstatcache(); |
clearstatcache(); |
192 |
// print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>'; |
// print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'</div>'; |
193 |
} |
} |
194 |
|
|
195 |
print '<table class="border"width="100%">'; |
print '<table class="border" width="100%">'; |
196 |
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$product->ref.'</td></tr>'; |
|
197 |
print '<tr><td width="30%">'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>'; |
// Reference |
198 |
|
print '<tr>'; |
199 |
|
print '<td width="28%">'.$langs->trans("Ref").'</td><td colspan="3">'; |
200 |
|
$product->load_previous_next_ref(); |
201 |
|
$previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_previous.'">'.img_previous().'</a>':''; |
202 |
|
$next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.$product->ref_next.'">'.img_next().'</a>':''; |
203 |
|
if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">'; |
204 |
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>'; |
205 |
|
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>'; |
206 |
|
print '</td>'; |
207 |
|
print '</tr>'; |
208 |
|
|
209 |
|
// Libelle |
210 |
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td></tr>'; |
211 |
|
|
212 |
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>'; |
213 |
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>'; |
214 |
print '</table>'; |
print '</table>'; |
281 |
} |
} |
282 |
print '</table>'; |
print '</table>'; |
283 |
|
|
|
print '</div>'; |
|
284 |
} |
} |
285 |
else |
else |
286 |
{ |
{ |