'."\n";
@@ -581,8 +610,8 @@ else
print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1);
print '';
}
- print '';
- $searchpitco=$form->showFilterAndCheckAddButtons(0);
+ print ' ';
+ $searchpitco=$form->showFilterButtons();
print $searchpitco;
print ' ';
@@ -632,14 +661,14 @@ else
$i = 0;
while ($i < min($num,$limit))
{
- $objp = $db->fetch_object($resql);
+ $obj = $db->fetch_object($resql);
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
{
$sql = "SELECT label";
$sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
- $sql.= " WHERE fk_product=".$objp->rowid;
+ $sql.= " WHERE fk_product=".$obj->rowid;
$sql.= " AND lang='". $langs->getDefaultLang() ."'";
$sql.= " LIMIT 1";
@@ -647,22 +676,22 @@ else
if ($result)
{
$objtp = $db->fetch_object($result);
- if (! empty($objtp->label)) $objp->label = $objtp->label;
+ if (! empty($objtp->label)) $obj->label = $objtp->label;
}
}
- $product_static->id = $objp->rowid;
- $product_static->ref = $objp->ref;
- $product_static->ref_fourn = $objp->ref_supplier;
- $product_static->label = $objp->label;
- $product_static->type = $objp->fk_product_type;
- $product_static->status_buy = $objp->tobuy;
- $product_static->status = $objp->tosell;
- $product_static->entity = $objp->entity;
+ $product_static->id = $obj->rowid;
+ $product_static->ref = $obj->ref;
+ $product_static->ref_fourn = $obj->ref_supplier;
+ $product_static->label = $obj->label;
+ $product_static->type = $obj->fk_product_type;
+ $product_static->status_buy = $obj->tobuy;
+ $product_static->status = $obj->tosell;
+ $product_static->entity = $obj->entity;
if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock
{
- if ($objp->fk_product_type != 1) // Not a service
+ if ($obj->fk_product_type != 1) // Not a service
{
$product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock()
}
@@ -688,27 +717,27 @@ else
// Label
if (! empty($arrayfields['p.label']['checked']))
{
- print ''.dol_trunc($objp->label,40).' ';
+ print ''.dol_trunc($obj->label,40).' ';
}
// Barcode
if (! empty($arrayfields['p.barcode']['checked']))
{
- print ''.$objp->barcode.' ';
+ print ''.$obj->barcode.' ';
}
// Duration
if (! empty($arrayfields['p.duration']['checked']))
{
print '';
- if (preg_match('/([0-9]+)[a-z]/i',$objp->duration))
+ if (preg_match('/([0-9]+)[a-z]/i',$obj->duration))
{
- if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
- elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
- elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
- elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
- //elseif (preg_match('/([0-9]+)h/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
- else print $objp->duration;
+ if (preg_match('/([0-9]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
+ elseif (preg_match('/([0-9]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
+ elseif (preg_match('/([0-9]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
+ elseif (preg_match('/([0-9]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
+ //elseif (preg_match('/([0-9]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour");
+ else print $obj->duration;
}
print ' ';
}
@@ -717,10 +746,10 @@ else
if (! empty($arrayfields['p.sellprice']['checked']))
{
print '';
- if ($objp->tosell)
+ if ($obj->tosell)
{
- if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
- else print price($objp->price).' '.$langs->trans("HT");
+ if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC");
+ else print price($obj->price).' '.$langs->trans("HT");
}
print ' ';
}
@@ -729,10 +758,10 @@ else
if (! empty($arrayfields['p.minbuyprice']['checked']))
{
print '';
- if ($objp->tobuy && $objp->minsellprice != '')
+ if ($obj->tobuy && $obj->minsellprice != '')
{
- //print price($objp->minsellprice).' '.$langs->trans("HT");
- if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0)
+ //print price($obj->minsellprice).' '.$langs->trans("HT");
+ if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0)
{
if ($product_fourn->product_fourn_price_id > 0)
{
@@ -752,9 +781,9 @@ else
if (! empty($arrayfields['p.seuil_stock_alerte']['checked']))
{
print ' ';
- if ($objp->fk_product_type != 1)
+ if ($obj->fk_product_type != 1)
{
- print $objp->seuil_stock_alerte;
+ print $obj->seuil_stock_alerte;
}
print ' ';
}
@@ -762,9 +791,9 @@ else
if (! empty($arrayfields['p.desiredstock']['checked']))
{
print '';
- if ($objp->fk_product_type != 1)
+ if ($obj->fk_product_type != 1)
{
- print $objp->desiredstock;
+ print $obj->desiredstock;
}
print ' ';
}
@@ -772,9 +801,9 @@ else
if (! empty($arrayfields['p.stock']['checked']))
{
print '';
- if ($objp->fk_product_type != 1)
+ if ($obj->fk_product_type != 1)
{
- if ($objp->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
+ if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
print $product_static->stock_reel;
}
print ' ';
@@ -783,9 +812,9 @@ else
if (! empty($arrayfields['stock_virtual']['checked']))
{
print '';
- if ($objp->fk_product_type != 1)
+ if ($obj->fk_product_type != 1)
{
- if ($objp->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
+ if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
print $product_static->stock_theorique;
}
print ' ';
@@ -794,13 +823,13 @@ else
if (! empty($arrayfields['p.tobatch']['checked']))
{
print '';
- print yn($objp->tobatch);
+ print yn($obj->tobatch);
print ' ';
}
// Accountancy code sell
- if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''.$objp->accountancy_code_sell.' ';
+ if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''.$obj->accountancy_code_sell.' ';
// Accountancy code sell
- if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''.$objp->accountancy_code_buy.' ';
+ if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''.$obj->accountancy_code_buy.' ';
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@@ -813,7 +842,7 @@ else
if ($align) print ' align="'.$align.'"';
print '>';
$tmpkey='options_'.$key;
- print $extrafields->showOutputField($key, $objp->$tmpkey, '', 1);
+ print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
print '';
}
}
@@ -826,14 +855,14 @@ else
if (! empty($arrayfields['p.datec']['checked']))
{
print '';
- print dol_print_date($objp->date_creation, 'dayhour');
+ print dol_print_date($obj->date_creation, 'dayhour');
print ' ';
}
// Date modification
if (! empty($arrayfields['p.tms']['checked']))
{
print '';
- print dol_print_date($objp->date_update, 'dayhour');
+ print dol_print_date($obj->date_update, 'dayhour');
print ' ';
}
@@ -844,7 +873,7 @@ else
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else {
- print $product_static->LibStatut($objp->tosell,5,0);
+ print $product_static->LibStatut($obj->tosell,5,0);
}
print '';
}
@@ -855,12 +884,19 @@ else
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else {
- print $product_static->LibStatut($objp->tobuy,5,1);
+ print $product_static->LibStatut($obj->tobuy,5,1);
}
print '';
}
- // Action
- print ' ';
+ // Action
+ print '';
+ if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ {
+ $selected=0;
+ if (in_array($obj->rowid, $arrayofselected)) $selected=1;
+ print ' ';
+ }
+ print ' ';
print "\n";
$i++;