diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 10f5fc25695..bb7e399f28a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5157,7 +5157,7 @@ class Form * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * * @param object $object Object to show - * @param string $paramid Name of parameter to use to name the id into the URL link + * @param string $paramid Name of parameter to use to name the id into the URL next/previous link * @param string $morehtml More html content to output just before the nav bar * @param int $shownav Show Condition (navigation is shown if value is 1) * @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field) @@ -5192,7 +5192,7 @@ class Form $ret.='
'; - // For thirdparty and contact, the ref is he id, so we show something else + // For thirdparty and contact, the ref is the id, so we show something else if ($object->element == 'societe') { $ret.=dol_htmlentities($object->name); @@ -5360,7 +5360,7 @@ class Form else { $nophoto='/public/theme/common/nophoto.png'; - if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users + if (in_array($modulepart,array('userphoto','contact'))) // For module that are "physical" users { $nophoto='/public/theme/common/user_anonymous.png'; if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index be0523958bd..db59c8d966d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -854,7 +854,7 @@ function dol_get_fiche_end($notab=0) * Show tab footer of a card * * @param object $object Object to show - * @param string $paramid Name of parameter to use to name the id into the URL link + * @param string $paramid Name of parameter to use to name the id into the URL next/previous link * @param string $morehtml More html content to output just before the nav bar * @param int $shownav Show Condition (navigation is shown if value is 1) * @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field) @@ -870,28 +870,67 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { global $conf, $form, $user, $langs; - //$showlogo=$object->logo; - $showlogo=1; + $maxvisiblephotos=1; + $showimage=1; $showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0); if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; - $modulepart='societe'; + $modulepart='unknown'; + if ($object->element == 'societe') $modulepart='societe'; if ($object->element == 'contact') $modulepart='contact'; if ($object->element == 'member') $modulepart='memberphoto'; if ($object->element == 'user') $modulepart='userphoto'; + if ($object->element == 'product') $modulepart='product'; print '
'; - if ($showlogo) $morehtmlleft.='
'.$form->showphoto($modulepart,$object,0,0,0,'photoref').'
'; + if ($object->element == 'product') + { + $width=80; $cssclass='photoref'; + $showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]); + $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); + if ($conf->browser->phone) $maxvisiblephotos=1; + if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->product->multidir_output[$object->entity],1,-$maxvisiblephotos,0,0,0,$width,0).'
'; + else + { + $nophoto='/public/theme/common/nophoto.png'; + $morehtmlleft.='
No photo
'; + } + } + else + { + if ($showimage) $morehtmlleft.='
'.$form->showphoto($modulepart,$object,0,0,0,'photoref','',1,0,$maxvisiblephotos).'
'; + } if ($showbarcode) $morehtmlleft.='
'.$form->showbarcode($object).'
'; if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { $morehtmlright.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); - } else { + } + elseif ($object->element == 'product') + { + //$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Sell").') '; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + $morehtmlright.=ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + } else { + $morehtmlright.=$object->getLibStatut(2,0); + } + $morehtmlright.='   '; + //$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Buy").') '; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + $morehtmlright.=ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + } else { + $morehtmlright.=$object->getLibStatut(2,1); + } + } + else { $morehtmlright.=$object->getLibStatut(2); } - if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; - $morehtmlref.='
'; - $morehtmlref.=$object->getBannerAddress('refaddress',$object); - $morehtmlref.='
'; - if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member'))) + if (! empty($object->name_alias)) $morehtmlref.='
'.$object->name_alias.'
'; // For thirdparty + if (! empty($object->label)) $morehtmlref.='
'.$object->label.'
'; // For product + if ($object->element != 'product') + { + $morehtmlref.='
'; + $morehtmlref.=$object->getBannerAddress('refaddress',$object); + $morehtmlref.='
'; + } + if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) { $morehtmlref.='
'; $morehtmlref.=$langs->trans("TechnicalID").': '.$object->id; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 9fadd0f3e5a..dcc303a2e0b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1239,16 +1239,9 @@ else print $object->showOptionals($extrafields,'edit'); } - // Note - print ''.$langs->trans("NoteNotVisibleOnBill").''; - - $doleditor = new DolEditor('note', $object->note, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); - $doleditor->Create(); - - print ""; - - if($conf->categorie->enabled) { - // Categories + // Tags-Categories + if ($conf->categorie->enabled) + { print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); $c = new Categorie($db); @@ -1260,6 +1253,14 @@ else print ""; } + // Note + print ''.$langs->trans("NoteNotVisibleOnBill").''; + + $doleditor = new DolEditor('note', $object->note, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); + $doleditor->Create(); + + print ""; + print ''; print '
'; @@ -1298,58 +1299,29 @@ else // Fiche en mode visu else { - $head=product_prepare_head($object); + $showbarcode=empty($conf->barcode->enabled)?0:1; + if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; + + $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'card', $titre, 0, $picto); - $showphoto=$object->is_photo_available($conf->product->multidir_output[$object->entity]); - $showbarcode=empty($conf->barcode->enabled)?0:1; - if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; - - // En mode visu - print ''; - - // Ref - print ''; - - print ''; - - // Label - print ''; - - $nblignes=7; - if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) $nblignes++; - if ($showbarcode) $nblignes+=2; - if ($object->type!= Product::TYPE_SERVICE) $nblignes++; - if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2; - if ($object->isservice()) $nblignes++; - else $nblignes+=4; - - // Photo - if ($showphoto || $showbarcode) - { - print ''; - } - - print ''; - + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + + print '
'; + print '
'; + + print '
'; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'ref','',1,'ref'); - print '
'.$langs->trans("Label").''.$object->label.''; - print '
'; - $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); - if ($conf->browser->phone) $maxvisiblephotos=1; - if ($showphoto) print $object->show_photos($conf->product->multidir_output[$object->entity],1,$maxvisiblephotos,0,0,0,80); - if ($showphoto && $showbarcode) print '

'; - if ($showbarcode) print $form->showbarcode($object); - print '
'; - print '
'; + // Type if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) { // TODO change for compatibility with edit in place $typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); - print ''; } @@ -1412,6 +1384,7 @@ else print ''; // Status (to sell) + /* print ''; - + */ + // Batch number management (to batch) if (! empty($conf->productbatch->enabled)) { print ''; + print '
'.$form->editfieldkey("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat).''; + print '
'.$form->editfieldkey("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat).''; print $form->editfieldval("Type",'fk_product_type',$object->type,$object,$user->rights->produit->creer||$user->rights->service->creer,$typeformat); print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); @@ -1428,7 +1401,8 @@ else print $object->getLibStatut(2,1); } print '
'.$langs->trans("ManageLotSerial").''; @@ -1448,10 +1422,17 @@ else print dol_print_url($object->url); print '
'; + print '
'; + print '
'; + + print '
'; + print ''; + // Nature if($object->type!= Product::TYPE_SERVICE) { - print ''; } @@ -1459,7 +1440,7 @@ else if ($object->isservice()) { // Duration - print ''."\n"; - print ' '."\n"; - // Categories if($conf->categorie->enabled) { print '"; } - print "
'.$langs->trans("Nature").''; + print '
'.$langs->trans("Nature").''; print $object->getLibFinished(); print '
'.$langs->trans("Duration").''.$object->duration_value.' '; + print '
'.$langs->trans("Duration").''.$object->duration_value.' '; if ($object->duration_value > 1) { $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); @@ -1475,7 +1456,7 @@ else else { // Weight - print '
'.$langs->trans("Weight").''; + print '
'.$langs->trans("Weight").''; if ($object->weight != '') { print $object->weight." ".measuring_units_string($object->weight_units,"weight"); @@ -1549,11 +1530,6 @@ else print $object->showOptionals($extrafields); } - // Note - print ' '."\n"; - print '
'.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'
'.$langs->trans("Categories").''; @@ -1561,8 +1537,17 @@ else print "
\n"; + // Note + print ' '."\n"; + print ''.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).''."\n"; + print ' '."\n"; + print "\n"; + print '
'; + + print '
'; + print '
'; + dol_fiche_end(); } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4c1fbc6c929..aea4a3c1433 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3485,9 +3485,10 @@ class Product extends CommonObject * @param int $showaction 1=Show icon with action links (resize, delete) * @param int $maxHeight Max height of image when size=1 * @param int $maxWidth Max width of image when size=1 + * @param int $nolink Do not add a href link to view enlarged imaged into a new tab * @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) + function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxHeight=120,$maxWidth=160,$nolink=0) { global $conf,$user,$langs; @@ -3552,7 +3553,7 @@ class Product extends CommonObject else if ($nbbyrow < 0) $return .= '
'; $return.= "\n"; - $return.= ''; + if (empty($nolink)) $return.= ''; // Show image (width height=$maxHeight) // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine @@ -3568,7 +3569,8 @@ class Product extends CommonObject $return.= 'dol_use_jmobile?'max-height':'height').'="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; } - $return.= ''."\n"; + if (empty($nolink)) $return.= ''; + $return.="\n"; if ($showfilename) $return.= '
'.$viewfilename; if ($showaction)