diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 5944af367e6..14bd3be67a2 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -64,15 +64,6 @@ function product_prepare_head($object, $user) $h++; } - // Show barcode tab - if ($conf->global->MAIN_MODULE_BARCODE && $user->rights->barcode->lire) - { - $head[$h][0] = DOL_URL_ROOT."/product/barcode.php?id=".$object->id; - $head[$h][1] = $langs->trans("BarCode"); - $head[$h][2] = 'barcode'; - $h++; - } - // Multilangs if($conf->global->MAIN_MULTILANGS) { diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php deleted file mode 100644 index e7aadd55177..00000000000 --- a/htdocs/product/barcode.php +++ /dev/null @@ -1,165 +0,0 @@ - - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/product/barcode.php - * \ingroup product - * \brief Page with bar code informations of product - */ - -require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); -require_once(DOL_DOCUMENT_ROOT."/core/class/html.formbarcode.class.php"); - -$langs->load("products"); -$langs->load("bills"); - -$id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); -$action = GETPOST('action','alpha'); - -// Security check -$fieldvalue = (! empty($id) ? $id : $ref); -$fieldname = (! empty($ref) ? 'ref' : 'rowid'); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'produit|service&barcode',$fieldvalue,'product','','',$fieldname); - -$object = new Product($db); - -/* - * Actions - */ - -// Modification du type de code barre -if ($action == 'setbarcodetype' && $user->rights->barcode->creer) -{ - $object->fetch($id); - $object->barcode_type = $_POST['barcodetype_id']; - $result = $object->update_barcode_type($user); - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; -} - -// Modification du code barre -if ($action == 'setbarcode' && $user->rights->barcode->creer) -{ - $object->fetch($id); - $object->barcode = $_POST['barcode']; //Todo: ajout verification de la validite du code barre en fonction du type - $result = $object->update_barcode($user); - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - exit; -} - - -/* - * View - */ - -llxHeader("","",$langs->trans("BarCode")); - -$form = new Form($db); -$formbarcode = new FormBarCode($db); - -$result = $object->fetch($id,$ref); - -$head=product_prepare_head($object, $user); -$titre=$langs->trans("CardProduct".$object->type); -$picto=($object->type==1?'service':'product'); -dol_fiche_head($head, 'barcode', $titre, 0, $picto); - - -print ''."\n"; - -// Reference -print ''; -print ''; -print ''."\n"; - -// Libelle -print ''; - -// Barcode image -$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code); -print ''; - -print ''."\n"; - -// Status (to sell) -print ''; - -// Status (to buy) -print ''; - -// Barcode type -print ''."\n"; - -// Barcode value -print ''."\n"; - -print "
'.$langs->trans("Ref").''; -print $form->showrefnav($object,'ref','',1,'ref'); -print '
'.$langs->trans("Label").''.$object->libelle.''; -print ''; -print ''; -print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; -print $object->getLibStatut(2,0); -print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; -print $object->getLibStatut(2,1); -print '
'; -print ''; -print '
'; -print $langs->trans("BarcodeType"); -print ''; -if (($_GET['action'] != 'editbarcodetype') && $user->rights->barcode->creer) print 'id.'">'.img_edit($langs->trans('SetBarcodeType'),1).'
'; -print '
'; -if ($_GET['action'] == 'editbarcodetype') -{ - $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'barcodetype_id'); -} -else -{ - print $object->barcode_type_label?$object->barcode_type_label:'
'.$langs->trans("SetDefaultBarcodeType").'
'; -} -print '
'; -print ''; -print '
'; -print $langs->trans("BarcodeValue"); -print ''; -if (($_GET['action'] != 'editbarcode') && $user->rights->barcode->creer) print 'id.'">'.img_edit($langs->trans('SetBarcode'),1).'
'; -print '
'; -if ($_GET['action'] == 'editbarcode') -{ - print '
'; - print ''; - print ''; - print ''; - print ' '; -} -else -{ - print $object->barcode; -} -print '
\n"; -print "\n"; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8192b4bb9e6..c85b1af7357 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -403,7 +403,7 @@ class Product extends CommonObject global $langs, $conf; $error=0; - + // Verification parametres if (! $this->libelle) $this->libelle = 'MISSING LABEL'; @@ -2547,18 +2547,18 @@ class Product extends CommonObject /** - * Show photos of a product (nbmax maximum) + * Show photos of a product (nbmax maximum) + * TODO Move this into html.formproduct.class.php * - * @param sdir Directory to scan - * @param size 0=original size, 1 use thumbnail if possible - * @param nbmax Nombre maximum de photos (0=pas de max) - * @param nbbyrow Nombre vignettes par ligne (si mode vignette) - * @param showfilename 1=Show filename - * @param showaction 1=Show icon with action links (resize, delete) - * @param maxHeight Max height of image when size=1 - * @param maxWidth Max width of image when size=1 - * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto - * TODO Move this into html.formproduct.class.php + * @param sdir Directory to scan + * @param size 0=original size, 1 use thumbnail if possible + * @param nbmax Nombre maximum de photos (0=pas de max) + * @param nbbyrow Nombre vignettes par ligne (si mode vignette) + * @param showfilename 1=Show filename + * @param showaction 1=Show icon with action links (resize, delete) + * @param maxHeight Max height of image when size=1 + * @param maxWidth Max width of image when size=1 + * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160) { @@ -2572,7 +2572,6 @@ class Product extends CommonObject $dirthumb = $dir.'thumbs/'; $pdirthumb = $pdir.'thumbs/'; - $return =''."\n"; /*$return.="