The component selectAjaxArray can return javascript part into a global

"delayed" variable so caller can output it at end of page. This reduce
the Flash Over Unstyle Content effect.
This commit is contained in:
Laurent Destailleur 2015-11-07 15:13:51 +01:00
parent c0872d690e
commit 57e162d7f8
14 changed files with 158 additions and 216 deletions

View File

@ -4513,22 +4513,25 @@ class Form
* @param string $morecss Add more class to css styles
* @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected.
* @param string $placeholder String to use as placeholder
* @return string HTML select string.
* @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string
*/
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='')
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
{
global $langs;
global $delayedhtmlcontent;
$out = '';
$tmpplugin='select2';
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$out='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
$outdelayed='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript">
$(document).ready(function () {
'.($callurlonselect ? 'var saveRemoteData = [];':'').'
'.($callurlonselect ? 'var saveRemoteData = [];':'').'
$(".'.$htmlname.'").select2({
$(".'.$htmlname.'").select2({
ajax: {
dir: "ltr",
url: "'.$url.'",
@ -4584,12 +4587,17 @@ class Form
});
});' : '' ) . '
});
</script>';
});
</script>';
$out.='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
if ($acceptdelayedhtml)
{
$delayedhtmlcontent.=$outdelayed;
}
else
{
$out.=$outdelayed;
}
return $out;
}

View File

@ -931,7 +931,7 @@ if (! function_exists("llxHeader"))
}
if (empty($conf->dol_hide_leftmenu))
{
left_menu('', $help_url, '', '', 1, $title);
left_menu('', $help_url, '', '', 1, $title, 1);
}
// main area
@ -1401,13 +1401,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
</script>' . "\n";
}
// Wrapper to show tooltips
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
});
</script>' . "\n";
// Raven.js for client-side Sentry logging support
if (array_key_exists('mod_syslog_sentry', $conf->loghandlers) && ! empty($conf->global->SYSLOG_SENTRY_DSN))
{
@ -1539,9 +1532,10 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
* @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
* @param string $title Title of web page
* @param string $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return void
*/
function left_menu($menu_array_before, $helppagename='', $notused='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='')
function left_menu($menu_array_before, $helppagename='', $notused='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='', $acceptdelayedhtml=0)
{
global $user, $conf, $langs, $db, $form;
global $hookmanager, $menumanager;
@ -1563,7 +1557,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
{
if (! is_object($form)) $form=new Form($db);
$selected=-1;
$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"));
$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
}
else
{
@ -1770,7 +1764,6 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
print "\n";
print '<!-- Begin right area -->'."\n";
if (empty($leftmenuwithoutmainarea)) main_area($title);
}
@ -1892,6 +1885,7 @@ if (! function_exists("llxFooter"))
/**
* Show HTML footer
* Close div /DIV data-role=page + /DIV class=fiche + /DIV /DIV main layout + /BODY + /HTML.
* If global var $delayedhtmlcontent was filled, we output it just before closing the body.
*
* @param string $comment A text to add as HTML comment into HTML generated page
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
@ -1900,7 +1894,8 @@ if (! function_exists("llxFooter"))
function llxFooter($comment='',$zone='private')
{
global $conf, $langs;
global $delayedhtmlcontent;
// Global html output events ($mesgs, $errors, $warnings)
dol_htmloutput_events();
@ -1937,6 +1932,18 @@ if (! function_exists("llxFooter"))
//var_dump($langs); // Uncommment to see the property _tab_loaded to see which language file were loaded
if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile) && empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div> <!-- End div id-container -->'."\n"; // End div container
if (! empty($delayedhtmlcontent)) print $delayedhtmlcontent;
// Wrapper to show tooltips
print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
});
</script>' . "\n";
print "</body>\n";
print "</html>\n";
}

View File

@ -91,7 +91,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="border tableforfield" width="100%">';
// Total Margin
print '<tr><td>'.$langs->trans("TotalMargin").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="3">';
print '<span id="totalMargin"></span>'; // set by jquery (see below)
print '</td></tr>';

View File

@ -2207,7 +2207,7 @@ class Product extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as d, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.rowid = d.fk_facture";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('facture', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2236,7 +2236,7 @@ class Product extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as d, ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.rowid = d.fk_facture_fourn";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('facture_fourn', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2265,7 +2265,7 @@ class Product extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.rowid = d.fk_propal";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
$sql.= " AND p.fk_soc = s.rowid";
$sql.= " AND p.entity IN (".getEntity('propal', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2292,7 +2292,7 @@ class Product extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as d, ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.rowid = d.fk_commande";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
$sql.= " AND c.fk_soc = s.rowid";
$sql.= " AND c.entity IN (".getEntity('commande', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -2319,7 +2319,7 @@ class Product extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as d, ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.rowid = d.fk_commande";
$sql.= " AND d.fk_product =".$this->id;
if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id;
$sql.= " AND c.fk_soc = s.rowid";
$sql.= " AND c.entity IN (".getEntity('commande_fournisseur', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;

View File

@ -202,7 +202,7 @@ if ($object->id)
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';

View File

@ -38,7 +38,7 @@ $langs->load("products");
$langs->load("bills");
$langs->load("other");
$id = GETPOST('id','int');
$id = GETPOST('id','int'); // For this page, id can also be 'all'
$ref = GETPOST('ref');
$mode = (GETPOST('mode') ? GETPOST('mode') : 'byunit');
$error = 0;
@ -56,16 +56,24 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','',
/*
* View
*/
$form = new Form($db);
if (! empty($id) || ! empty($ref))
if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
{
$object = new Product($db);
$result = $object->fetch($id,$ref);
llxHeader("","",$langs->trans("CardProduct".$object->type));
if ($result)
if (! empty($id) || ! empty($ref))
{
$result = $object->fetch($id,$ref);
llxHeader("",$langs->trans("CardProduct".$object->type));
}
else
{
llxHeader("",$langs->trans("ProductStatistics"));
}
if ($result && (! empty($id) || ! empty($ref)))
{
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
@ -73,37 +81,18 @@ if (! empty($id) || ! empty($ref))
dol_fiche_head($head, 'stats', $titre, 0, $picto);
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
print $object->getLibStatut(2,0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
print $object->getLibStatut(2,1);
print '</td></tr>';
print '</table>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
dol_fiche_end();
}
if ($result)
{
// Choice of stats
if (! empty($conf->dol_use_jmobile)) print "\n".'<div class="fichecenter"><div class="nowrap">'."\n";
if ($mode == 'bynumber') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mode=byunit">';
if ($mode == 'bynumber') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).'&mode=byunit">';
else print img_picto('','tick').' ';
print $langs->trans("StatsByNumberOfUnits");
if ($mode == 'bynumber') print '</a>';
@ -111,7 +100,7 @@ if (! empty($id) || ! empty($ref))
if (! empty($conf->dol_use_jmobile)) print '</div>'."\n".'<div class="nowrap">'."\n";
else print ' &nbsp; / &nbsp; ';
if ($mode == 'byunit') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mode=bynumber">';
if ($mode == 'byunit') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).'&mode=bynumber">';
else print img_picto('','tick').' ';
print $langs->trans("StatsByNumberOfEntities");
if ($mode == 'byunit') print '</a>';
@ -237,13 +226,13 @@ if (! empty($id) || ! empty($ref))
if ($graphfiles[$key]['output'] && ! $px->isGraphKo())
{
if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) print '<td>'.$langs->trans("GeneratedOn",dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']),"dayhour")).'</td>';
else print '<td>'.$langs->trans("GeneratedOn",dol_print_date(dol_now()),"dayhour").'</td>';
else print '<td>'.$langs->trans("GeneratedOn",dol_print_date(dol_now(),"dayhour")).'</td>';
}
else
{
print '<td>'.($mesg?'<font class="error">'.$mesg.'</font>':$langs->trans("ChartNotGenerated")).'</td>';
}
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=recalcul&amp;mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'</a></td>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).'&amp;action=recalcul&amp;mode='.$mode.'">'.img_picto($langs->trans("ReCalculate"),'refresh').'</a></td>';
print '</tr>';
print '</table>';

View File

@ -81,6 +81,8 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -97,34 +99,22 @@ if ($id > 0 || ! empty($ref))
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->label.'</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
print $product->getLibStatut(2,0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
print $product->getLibStatut(2,1);
print '</td></tr>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
show_stats_for_company($product,$socid);
print "</table>";
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
if ($user->rights->commande->lire)
{

View File

@ -86,16 +86,17 @@ if ($id > 0 || ! empty($ref)) {
$product = new Product($db);
$result = $product->fetch($id, $ref);
$parameters = array (
'id' => $id
);
$object = $product;
$parameters = array ('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("", "", $langs->trans("CardProduct" . $product->type));
if ($result > 0) {
if ($result > 0)
{
$head = product_prepare_head($product);
$titre = $langs->trans("CardProduct" . $product->type);
$picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
@ -105,34 +106,22 @@ if ($id > 0 || ! empty($ref)) {
if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">';
print $form->showrefnav($product, 'ref', '', 1, 'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>' . $langs->trans("Label") . '</td><td colspan="3">' . $product->label . '</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 1);
print '</td></tr>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
show_stats_for_company($product, $socid);
print "</table>";
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
if ($user->rights->fournisseur->commande->lire)
{

View File

@ -71,6 +71,8 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -87,34 +89,22 @@ if ($id > 0 || ! empty($ref))
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '<table class="border" width="100%">';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->label.'</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
print $product->getLibStatut(2,0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
print $product->getLibStatut(2,1);
print '</td></tr>';
show_stats_for_company($product,$socid);
show_stats_for_company($product,$socid);
print "</table>";
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
$now=dol_now();

View File

@ -81,7 +81,9 @@ if ($id > 0 || ! empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -98,34 +100,21 @@ if ($id > 0 || ! empty($ref))
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->label.'</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
print $product->getLibStatut(2,0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
print $product->getLibStatut(2,1);
print '</td></tr>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
show_stats_for_company($product,$socid);
print "</table>";
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
if ($user->rights->facture->lire)

View File

@ -83,6 +83,8 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -99,34 +101,22 @@ if ($id > 0 || ! empty($ref))
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">';
print $form->showrefnav($product, 'ref', '', 1, 'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>' . $langs->trans("Label") . '</td><td colspan="3">' . $product->label . '</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 1);
print '</td></tr>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
show_stats_for_company($product, $socid);
print "</table>";
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
if ($user->rights->fournisseur->facture->lire)
{

View File

@ -81,6 +81,8 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
$parameters = array ('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -97,34 +99,22 @@ if ($id > 0 || ! empty($ref))
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="30%">' . $langs->trans("Ref") . '</td><td colspan="3">';
print $form->showrefnav($product, 'ref', '', 1, 'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>' . $langs->trans("Label") . '</td><td colspan="3">' . $product->label . '</td>';
print '</tr>';
// Status (to sell)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 0);
print '</td></tr>';
// Status (to buy)
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')</td><td colspan="3">';
print $product->getLibStatut(2, 1);
print '</td></tr>';
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
show_stats_for_company($product, $socid);
print "</table>";
print '</div>';
print '</div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
if ($user->rights->propale->lire)
{

View File

@ -399,14 +399,15 @@ if ($id > 0 || $ref)
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
if ($conf->productbatch->enabled) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
if ($conf->productbatch->enabled)
{
print '<tr><td class="titlefield">'.$langs->trans("ManageLotSerial").'</td><td>';
print $object->getLibStatut(0,2);
print '</td></tr>';
}
// PMP
print '<tr><td>'.$langs->trans("AverageUnitPricePMP").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("AverageUnitPricePMP").'</td>';
print '<td>';
if ($object->pmp > 0) print price($object->pmp).' '.$langs->trans("HT");
print '</td>';

View File

@ -68,7 +68,6 @@ print "Test 4d: a select with ajax refresh and with onchange call of url<br>\n";
$selected=-1;
print $form->selectArrayAjax('testselectc', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, 'style="min-width: 250px;"', '', 0, 1, '', 1);
print '<br><br>'."\n";
// Test5a: form->select_thirdparty