2
0
forked from Wavyzz/dolibarr

Use the new banner for first tab of products.

This commit is contained in:
Laurent Destailleur
2015-11-06 18:57:35 +01:00
parent 11f0cad2ab
commit d0e6db7f89
4 changed files with 106 additions and 80 deletions

View File

@@ -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 '<div class="arearef heightref valignmiddle" width="100%">';
if ($showlogo) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref').'</div>';
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.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->product->multidir_output[$object->entity],1,-$maxvisiblephotos,0,0,0,$width,0).'</div>';
else
{
$nophoto='/public/theme/common/nophoto.png';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
}
}
else
{
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref','',1,0,$maxvisiblephotos).'</div>';
}
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
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.=' &nbsp; ';
//$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.='<div class="refidno">'.$object->name_alias.'</div>';
$morehtmlref.='<div class="refidno">';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
$morehtmlref.='</div>';
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member')))
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>'; // For product
if ($object->element != 'product')
{
$morehtmlref.='<div class="refidno">';
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
$morehtmlref.='</div>';
}
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product')))
{
$morehtmlref.='<div style="clear: both;"></div><div class="refidno">';
$morehtmlref.=$langs->trans("TechnicalID").': '.$object->id;