Merge pull request #23125 from lamrani002/kanbanForProducts

New mode kaban for products list
This commit is contained in:
Laurent Destailleur
2023-01-23 01:15:13 +01:00
committed by GitHub
3 changed files with 367 additions and 253 deletions

View File

@@ -6303,6 +6303,59 @@ class Product extends CommonObject
return $prodDurationHours; return $prodDurationHours;
} }
/**
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
{
global $langs,$conf;
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<div class="info-box-img">';
$label = '';
if ($this->is_photo_available($conf->product->multidir_output[$this->entity])) {
$label .= $this->show_photos('product', $conf->product->multidir_output[$this->entity]);
$return .= $label;
} else {
if ($this->type == Product::TYPE_PRODUCT) {
$label .= img_picto('', 'product');
} elseif ($this->type == Product::TYPE_SERVICE) {
$label .= img_picto('', 'service');
}
$return .= $label;
}
$return .= '</div>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
if (property_exists($this, 'label')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$this->label.'</span>';
}
if (property_exists($this, 'price') && property_exists($this, 'price_ttc')) {
if ($this->price_base_type == 'TTC') {
$return .= '<br><span class="info-box-status amount">'.price($this->price_ttc).' '.$langs->trans("TTC").'</span>';
} else {
if ($this->status) {
$return .= '<br><span class="info-box-status amount">'.price($this->price).' '.$langs->trans("HT").'</span>';
}
}
}
if (property_exists($this, 'stock_reel')) {
$return .= '<br><span class="info-box-status opacitymedium">'.$langs->trans('PhysicalStock').' : <span class="bold">'.$this->stock_reel.'</span></span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .='<br><span class="info-box-status margintoponly">'.$this->getLibStatut(5, 1).' '.$this->getLibStatut(5, 0).'</span>';
}
$return .= '</div>';
$return .= '</div>';
$return .= '</div>';
return $return;
}
} }
/** /**

View File

@@ -97,6 +97,8 @@ $search_accountancy_code_buy_export = GETPOST("search_accountancy_code_buy_expor
$search_finished = GETPOST("search_finished", 'int'); $search_finished = GETPOST("search_finished", 'int');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$type = GETPOST("type", "int"); $type = GETPOST("type", "int");
$mode = GETPOST('mode', 'alpha');
//Show/hide child products //Show/hide child products
if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
@@ -672,6 +674,9 @@ if (GETPOST('delprod')) {
} }
$param = ''; $param = '';
if (!empty($mode)) {
$param = "&mode=".urlencode($mode);
}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
@@ -780,7 +785,9 @@ if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_ext
} }
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = ''; $newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
if ($type === "") { if ($type === "") {
$perm = ($user->rights->produit->creer || $user->rights->service->creer); $perm = ($user->rights->produit->creer || $user->rights->service->creer);
} elseif ($type == Product::TYPE_SERVICE) { } elseif ($type == Product::TYPE_SERVICE) {
@@ -788,8 +795,8 @@ if ($type === "") {
} elseif ($type == Product::TYPE_PRODUCT) { } elseif ($type == Product::TYPE_PRODUCT) {
$perm = $user->rights->produit->creer; $perm = $user->rights->produit->creer;
} }
$oldtype = $type; $oldtype = $type;
$params = array(); $params = array();
if ($type === "") { if ($type === "") {
$params['forcenohideoftext'] = 1; $params['forcenohideoftext'] = 1;
} }
@@ -797,13 +804,12 @@ if ($type === "") {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params);
$type = Product::TYPE_SERVICE; $type = Product::TYPE_SERVICE;
} }
$label = 'NewProduct'; $label = 'NewProduct';
if ($type == Product::TYPE_SERVICE) { if ($type == Product::TYPE_SERVICE) {
$label = 'NewService'; $label = 'NewService';
} }
$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', $perm, $params); $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', $perm, $params);
$type = $oldtype;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
if ($optioncss != '') { if ($optioncss != '') {
@@ -816,6 +822,8 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
//print '<input type="hidden" name="page" value="'.$page.'">'; //print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if (empty($arrayfields['p.fk_product_type']['checked'])) { if (empty($arrayfields['p.fk_product_type']['checked'])) {
print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">'; print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
} }
@@ -1321,13 +1329,15 @@ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print "</tr>\n"; print "</tr>\n";
$product_static = new Product($db);
$product_fourn = new ProductFournisseur($db);
$i = 0; $product_static = new Product($db);
$totalarray = array(); $product_fourn = new ProductFournisseur($db);
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) { $i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
// Multilangs // Multilangs
@@ -1346,62 +1356,76 @@ while ($i < min($num, $limit)) {
} }
} }
} }
}
$parameters = array('staticdata' => $obj); $parameters = array('staticdata' => $obj);
// Note that $action and $object may have been modified by hook // Note that $action and $object may have been modified by hook
// do product_static fetch in hook if wanted or anything else // do product_static fetch in hook if wanted or anything else
$reshook = $hookmanager->executeHooks('loadStaticObject', $parameters, $product_static, $action); $reshook = $hookmanager->executeHooks('loadStaticObject', $parameters, $product_static, $action);
if (empty($reshook)) { if (empty($reshook)) {
$product_static->id = $obj->rowid; $product_static->id = $obj->rowid;
$product_static->ref = $obj->ref; $product_static->ref = $obj->ref;
$product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated $product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated
$product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; $product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier;
$product_static->label = $obj->label; $product_static->label = $obj->label;
$product_static->finished = $obj->finished; $product_static->finished = $obj->finished;
$product_static->type = $obj->fk_product_type; $product_static->type = $obj->fk_product_type;
$product_static->status_buy = $obj->tobuy; $product_static->status_buy = $obj->tobuy;
$product_static->status = $obj->tosell; $product_static->status = $obj->tosell;
$product_static->status_batch = $obj->tobatch; $product_static->status_batch = $obj->tobatch;
$product_static->entity = $obj->entity; $product_static->entity = $obj->entity;
$product_static->pmp = $obj->pmp; $product_static->pmp = $obj->pmp;
$product_static->accountancy_code_sell = $obj->accountancy_code_sell; $product_static->accountancy_code_sell = $obj->accountancy_code_sell;
$product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export; $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$product_static->accountancy_code_buy = $obj->accountancy_code_buy; $product_static->accountancy_code_buy = $obj->accountancy_code_buy;
$product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra; $product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
$product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export; $product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
$product_static->length = $obj->length; $product_static->length = $obj->length;
$product_static->length_units = $obj->length_units; $product_static->length_units = $obj->length_units;
$product_static->width = $obj->width; $product_static->width = $obj->width;
$product_static->width_units = $obj->width_units; $product_static->width_units = $obj->width_units;
$product_static->height = $obj->height; $product_static->height = $obj->height;
$product_static->height_units = $obj->height_units; $product_static->height_units = $obj->height_units;
$product_static->weight = $obj->weight; $product_static->weight = $obj->weight;
$product_static->weight_units = $obj->weight_units; $product_static->weight_units = $obj->weight_units;
$product_static->volume = $obj->volume; $product_static->volume = $obj->volume;
$product_static->volume_units = $obj->volume_units; $product_static->volume_units = $obj->volume_units;
$product_static->surface = $obj->surface; $product_static->surface = $obj->surface;
$product_static->surface_units = $obj->surface_units; $product_static->surface_units = $obj->surface_units;
if (!empty($conf->global->PRODUCT_USE_UNITS)) { if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$product_static->fk_unit = $obj->fk_unit; $product_static->fk_unit = $obj->fk_unit;
} }
// STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock. // STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock if ((isModEnabled('stock') && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) { // To optimize call of load_stock
if ($product_static->type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service if ($product_static->type != 1 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { // Not a service
$option = 'nobatch'; $option = 'nobatch';
if (empty($arrayfields['stock_virtual']['checked'])) { if (empty($arrayfields['stock_virtual']['checked'])) {
$option .= ',novirtual'; $option .= ',novirtual';
}
$product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
} }
$product_static->load_stock($option); // Load stock_reel + stock_warehouse. This can also call load_virtual_stock()
} }
} }
}
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
if ($product_static->isService()) { $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire');
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire'); if ($product_static->isService()) {
$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire');
}
if ($mode == 'Kanban') {
if ($i == 0) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container">';
} }
$product_static->price = $obj->price;
// Output Kanban
print $product_static->getKanbanView('');
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';
}
} else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Action column // Action column
@@ -1467,7 +1491,7 @@ while ($i < min($num, $limit)) {
// Label // Label
if (!empty($arrayfields['p.label']['checked'])) { if (!empty($arrayfields['p.label']['checked'])) {
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($product_static->label).'">'.$product_static->label.'</td>'; print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).'">'.$obj->label.'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
@@ -1477,7 +1501,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['p.fk_product_type']['checked'])) { if (!empty($arrayfields['p.fk_product_type']['checked'])) {
print '<td class="center">'; print '<td class="center">';
$s = ''; $s = '';
if ($product_static->type == 0) { if ($obj->fk_product_type == 0) {
$s .= img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"'); $s .= img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"');
} else { } else {
$s .= img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"'); $s .= img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"');
@@ -1491,7 +1515,7 @@ while ($i < min($num, $limit)) {
// Barcode // Barcode
if (!empty($arrayfields['p.barcode']['checked'])) { if (!empty($arrayfields['p.barcode']['checked'])) {
print '<td>'.$product_static->barcode.'</td>'; print '<td>'.$obj->barcode.'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
@@ -1535,7 +1559,7 @@ while ($i < min($num, $limit)) {
// Weight // Weight
if (!empty($arrayfields['p.weight']['checked'])) { if (!empty($arrayfields['p.weight']['checked'])) {
print '<td class="center">'; print '<td class="center">';
print $product_static->weight; print $obj->weight;
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@@ -1555,7 +1579,7 @@ while ($i < min($num, $limit)) {
// Length // Length
if (!empty($arrayfields['p.length']['checked'])) { if (!empty($arrayfields['p.length']['checked'])) {
print '<td class="center">'; print '<td class="center">';
print $product_static->length; print $obj->length;
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@@ -1575,7 +1599,7 @@ while ($i < min($num, $limit)) {
// Width // Width
if (!empty($arrayfields['p.width']['checked'])) { if (!empty($arrayfields['p.width']['checked'])) {
print '<td align="center">'; print '<td align="center">';
print $product_static->width; print $obj->width;
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@@ -1595,7 +1619,7 @@ while ($i < min($num, $limit)) {
// Height // Height
if (!empty($arrayfields['p.height']['checked'])) { if (!empty($arrayfields['p.height']['checked'])) {
print '<td align="center">'; print '<td align="center">';
print $product_static->height; print $obj->height;
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@@ -1615,7 +1639,7 @@ while ($i < min($num, $limit)) {
// Surface // Surface
if (!empty($arrayfields['p.surface']['checked'])) { if (!empty($arrayfields['p.surface']['checked'])) {
print '<td class="center">'; print '<td class="center">';
print $product_static->surface; print $obj->surface;
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@@ -1635,7 +1659,7 @@ while ($i < min($num, $limit)) {
// Volume // Volume
if (!empty($arrayfields['p.volume']['checked'])) { if (!empty($arrayfields['p.volume']['checked'])) {
print '<td class="center">'; print '<td class="center">';
print $product_static->volume; print $obj->volume;
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
@@ -1667,7 +1691,7 @@ while ($i < min($num, $limit)) {
// Sell price // Sell price
if (!empty($arrayfields['p.sellprice']['checked'])) { if (!empty($arrayfields['p.sellprice']['checked'])) {
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
if ($product_static->status && $usercancreadprice) { if ($obj->tosell && $usercancreadprice) {
if ($obj->price_base_type == 'TTC') { if ($obj->price_base_type == 'TTC') {
print '<span class="amount">'.price($obj->price_ttc).' '.$langs->trans("TTC").'</span>'; print '<span class="amount">'.price($obj->price_ttc).' '.$langs->trans("TTC").'</span>';
} else { } else {
@@ -1690,7 +1714,7 @@ while ($i < min($num, $limit)) {
$productpricescache[$obj->rowid] = array(); $productpricescache[$obj->rowid] = array();
} }
if ($product_static->status && $usercancreadprice) { if ($obj->tosell && $usercancreadprice) {
// Make 1 request for all price levels (without filter on price_level) and saved result into an cache array // Make 1 request for all price levels (without filter on price_level) and saved result into an cache array
// then reuse the cache array if we need prices for other price levels // then reuse the cache array if we need prices for other price levels
$sqlp = "SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type"; $sqlp = "SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type";
@@ -1735,188 +1759,198 @@ while ($i < min($num, $limit)) {
} }
} }
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
}
} }
// Better buy price // Better buy price
if (!empty($arrayfields['p.minbuyprice']['checked'])) { if (!empty($arrayfields['p.minbuyprice']['checked'])) {
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
if ($product_static->status_buy && $obj->bestpurchaseprice != '' && $usercancreadprice) { if ($product_static->status_buy && $obj->bestpurchaseprice != '' && $usercancreadprice) {
if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) { if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) {
if ($product_fourn->product_fourn_price_id > 0) { if ($product_fourn->product_fourn_price_id > 0) {
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) { if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) {
$htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1); $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1);
print '<span class="amount">'.$form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent / 100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"), $htmltext).'</span>'; print '<span class="amount">'.$form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent / 100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"), $htmltext).'</span>';
} else { } else {
print '<span class="amount">'.price($product_fourn->fourn_unitprice).' '.$langs->trans("HT").'</span>'; print '<span class="amount">'.price($product_fourn->fourn_unitprice).' '.$langs->trans("HT").'</span>';
}
} }
} }
} print '</td>';
print '</td>'; if (!$i) {
if (!$i) { $totalarray['nbfield']++;
$totalarray['nbfield']++; }
} }
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Number of buy prices // Number of buy prices
if (!empty($arrayfields['p.numbuyprice']['checked'])) { if (!empty($arrayfields['p.numbuyprice']['checked'])) {
print '<td class="right">'; print '<td class="right">';
if ($product_static->status_buy && $usercancreadprice) { if ($product_static->status_buy && $usercancreadprice) {
if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) { if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) {
$htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList);
print $form->textwithpicto(count($productFournList), $htmltext); print $form->textwithpicto(count($productFournList), $htmltext);
}
} }
print '</td>';
} }
print '</td>';
}
// VAT or Sell Tax Rate // VAT or Sell Tax Rate
if (!empty($arrayfields['p.tva_tx']['checked'])) { if (!empty($arrayfields['p.tva_tx']['checked'])) {
print '<td class="right">'; print '<td class="right">';
print vatrate($obj->tva_tx, true); print vatrate($obj->tva_tx, true);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
}
} }
}
// WAP // WAP
if (!empty($arrayfields['p.pmp']['checked'])) { if (!empty($arrayfields['p.pmp']['checked'])) {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
if ($usercancreadprice) { if ($usercancreadprice) {
print '<span class="amount">'.price($product_static->pmp, 1, $langs)."</span>"; print '<span class="amount">'.price($product_static->pmp, 1, $langs)."</span>";
}
print '</td>';
} }
print '</td>';
}
// Cost price // Cost price
if (!empty($arrayfields['p.cost_price']['checked'])) { if (!empty($arrayfields['p.cost_price']['checked'])) {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
//print $obj->cost_price; //print $obj->cost_price;
if ($usercancreadprice) { if ($usercancreadprice) {
print '<span class="amount">'.price($obj->cost_price).' '.$langs->trans("HT").'</span>'; print '<span class="amount">'.price($obj->cost_price).' '.$langs->trans("HT").'</span>';
}
print '</td>';
} }
print '</td>';
}
// Limit alert // Limit alert
if (!empty($arrayfields['p.seuil_stock_alerte']['checked'])) { if (!empty($arrayfields['p.seuil_stock_alerte']['checked'])) {
print '<td class="right">'; print '<td class="right">';
if ($product_static->type != 1) { if ($product_static->type != 1) {
print $obj->seuil_stock_alerte; print $obj->seuil_stock_alerte;
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Desired stock // Desired stock
if (!empty($arrayfields['p.desiredstock']['checked'])) { if (!empty($arrayfields['p.desiredstock']['checked'])) {
print '<td class="right">'; print '<td class="right">';
if ($product_static->type != 1) { if ($product_static->type != 1) {
print $obj->desiredstock; print $obj->desiredstock;
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Stock real // Stock real
if (!empty($arrayfields['p.stock']['checked'])) { if (!empty($arrayfields['p.stock']['checked'])) {
print '<td class="right">'; print '<td class="right">';
if ($product_static->type != 1) { if ($product_static->type != 1) {
if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) { if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
if ($usercancreadprice) {
print price(price2num($product_static->stock_reel, 'MS'));
}
} }
print '</td>'; if ($usercancreadprice) {
if (!$i) { print price(price2num($product_static->stock_reel, 'MS'));
$totalarray['nbfield']++;
} }
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Stock virtual // Stock virtual
if (!empty($arrayfields['stock_virtual']['checked'])) { if (!empty($arrayfields['stock_virtual']['checked'])) {
print '<td class="right">'; print '<td class="right">';
if ($product_static->type != 1) { if ($product_static->type != 1) {
if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) { if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) {
print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' ';
}
if ($usercancreadprice) {
print price(price2num($product_static->stock_theorique, 'MS'));
}
} }
print '</td>'; if ($usercancreadprice) {
if (!$i) { print price(price2num($product_static->stock_theorique, 'MS'));
$totalarray['nbfield']++;
} }
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Lot/Serial // Lot/Serial
if (!empty($arrayfields['p.tobatch']['checked'])) { if (!empty($arrayfields['p.tobatch']['checked'])) {
print '<td class="center">'; print '<td class="center">';
print $product_static->getLibStatut(1, 2); print $product_static->getLibStatut(1, 2);
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
}
} }
}
// Country // Country
if (!empty($arrayfields['p.fk_country']['checked'])) { if (!empty($arrayfields['p.fk_country']['checked'])) {
print '<td>'.getCountry($obj->fk_country, 0, $db).'</td>'; print '<td>'.getCountry($obj->fk_country, 0, $db).'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
}
} }
}
// State // State
if (!empty($arrayfields['p.fk_state']['checked'])) { if (!empty($arrayfields['p.fk_state']['checked'])) {
print '<td>'; print '<td>';
if (!empty($obj->fk_state)) { if (!empty($obj->fk_state)) {
print getState($obj->fk_state, 0, $db); print getState($obj->fk_state, 0, $db);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy code sell // Accountancy code sell
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) { if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
print '<td>'.$product_static->accountancy_code_sell.'</td>'; print '<td>'.$product_static->accountancy_code_sell.'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
}
} }
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) { }
print '<td>'.$product_static->accountancy_code_sell_intra.'</td>'; if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
if (!$i) { print '<td>'.$product_static->accountancy_code_sell_intra.'</td>';
$totalarray['nbfield']++; if (!$i) {
} $totalarray['nbfield']++;
} }
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) { }
print '<td>'.$product_static->accountancy_code_sell_export.'</td>'; if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
if (!$i) { print '<td>'.$product_static->accountancy_code_sell_export.'</td>';
$totalarray['nbfield']++; if (!$i) {
} $totalarray['nbfield']++;
} }
}
// Accountancy code buy // Accountancy code buy
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) { if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
print '<td>'.$product_static->accountancy_code_buy.'</td>'; print '<td>'.$product_static->accountancy_code_buy.'</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
}
} }
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) { }
print '<td>'.$product_static->accountancy_code_buy_intra.'</td>'; if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
if (!$i) { print '<td>'.$product_static->accountancy_code_buy_intra.'</td>';
$totalarray['nbfield']++; if (!$i) {
} $totalarray['nbfield']++;
} }
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) { }
print '<td>'.$product_static->accountancy_code_buy_export.'</td>'; if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
if (!$i) { print '<td>'.$product_static->accountancy_code_buy_export.'</td>';
$totalarray['nbfield']++; if (!$i) {
} $totalarray['nbfield']++;
} }
}
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook // Fields from hook
@@ -1924,68 +1958,70 @@ while ($i < min($num, $limit)) {
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (!empty($arrayfields['p.datec']['checked'])) { if (!empty($arrayfields['p.datec']['checked'])) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
}
} }
}
// Date modification // Date modification
if (!empty($arrayfields['p.tms']['checked'])) { if (!empty($arrayfields['p.tms']['checked'])) {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
}
} }
}
// Status (to sell) // Status (to sell)
if (!empty($arrayfields['p.tosell']['checked'])) { if (!empty($arrayfields['p.tosell']['checked'])) {
print '<td class="center nowrap">'; print '<td class="center nowrap">';
if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
} else { } else {
print $product_static->LibStatut($product_static->status, 5, 0); print $product_static->LibStatut($product_static->status, 5, 0);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status (to buy) // Status (to buy)
if (!empty($arrayfields['p.tobuy']['checked'])) { if (!empty($arrayfields['p.tobuy']['checked'])) {
print '<td class="center nowrap">'; print '<td class="center nowrap">';
if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
} else { } else {
print $product_static->LibStatut($product_static->status_buy, 5, 1); print $product_static->LibStatut($product_static->status_buy, 5, 1);
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action column // Action column
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
print '<td class="nowrap center">'; print '<td class="nowrap center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined 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; $selected = 0;
if (in_array($obj->rowid, $arrayofselected)) { if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1; $selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
} }
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
} }
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
print "</tr>\n"; print "</tr>\n";
}
$i++; $i++;
} }

View File

@@ -189,6 +189,31 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
bottom: 0; bottom: 0;
} }
/* customize section img box on list of products */
.info-box-img {
height: 105px !important;
width: 88px;
border-top-left-radius: 2px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 2px;
display: block;
overflow: hidden;
float: left;
text-align: center;
font-size: 2.8em;
line-height: 90px;
margin-right: 5px;
background: var(--colorbacktitle1) !important;
}
.info-box-img > img {
width: 90%;
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?> <?php if (empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS) && !empty($conf->global->MAIN_INCLUDE_GLOBAL_STATS_IN_OPENED_DASHBOARD)) { ?>
.info-box-icon-text{ .info-box-icon-text{
opacity: 1; opacity: 1;