mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge home page product and service
This commit is contained in:
parent
7158757fa1
commit
aad893663d
|
|
@ -10031,8 +10031,8 @@ class Form
|
|||
$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 'sha256', 1) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash
|
||||
} else {
|
||||
if ($nophoto == 'company') {
|
||||
$ret .= '<div class="divforspanimg photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
|
||||
$ret .= '<div class="difforspanimgright"></div>';
|
||||
$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
|
||||
//$ret .= '<div class="difforspanimgright"></div>';
|
||||
} else {
|
||||
$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && isModEnabled("categorie")', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&action=create&type=4', 'NewCategory', 1, 'categories', '$user->hasRight("categorie","creer")', '', 2, 0, __ENTITY__);
|
||||
|
||||
-- Product - Product
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=product', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?mainmenu=products&leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&type=0', 'MenuStocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
|
||||
|
|
@ -131,7 +131,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
|||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("propal")', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&id=all&leftmenu=stats&type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 8, __ENTITY__);
|
||||
|
||||
-- Product - Services
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=service&type=1', 'Services', 0, 'products', '$user->hasRight("service","lire")', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&leftmenu=service', 'Services', 0, 'products', '$user->hasRight("service","lire")', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=service&action=create&type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2902__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/list.php?mainmenu=products&leftmenu=service&type=1', 'List', 1, 'products', '$user->hasRight("service","lire")', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("propal")', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&id=all&leftmenu=stats&type=1', 'Statistics', 1, 'main', '$user->hasRight("service","lire")', '', 2, 5, __ENTITY__);
|
||||
|
|
|
|||
|
|
@ -2069,7 +2069,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
|||
if ($mainmenu == 'products') {
|
||||
// Products
|
||||
if (isModEnabled('product')) {
|
||||
$newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/product/index.php?leftmenu=product", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->hasRight('product', 'creer'));
|
||||
$newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->hasRight('product', 'read'));
|
||||
if (isModEnabled('stock')) {
|
||||
|
|
@ -2097,7 +2097,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
|||
|
||||
// Services
|
||||
if (isModEnabled('service')) {
|
||||
$newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/product/index.php?leftmenu=service", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="paddingright pictofixedwidth"'));
|
||||
$newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->hasRight('service', 'creer'));
|
||||
$newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->hasRight('service', 'read'));
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ if (GETPOST('addbox')) {
|
|||
}
|
||||
}
|
||||
|
||||
$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
|
@ -304,15 +306,14 @@ if (isModEnabled('category') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_PRODU
|
|||
* Latest modified products
|
||||
*/
|
||||
if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
|
||||
$max = 15;
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
|
||||
$sql .= " p.entity,";
|
||||
$sql .= " p.tms as datem";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
|
||||
if ($type != '') {
|
||||
/*if ($type != '') {
|
||||
$sql .= " AND p.fk_product_type = ".((int) $type);
|
||||
}
|
||||
}*/
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $product_static); // Note that $action and $object may have been modified by hook
|
||||
|
|
@ -330,10 +331,10 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
|
|||
|
||||
if ($num > 0) {
|
||||
$transRecordedType = $langs->trans("LastModifiedProductsAndServices", $max);
|
||||
if (GETPOSTISSET("type") && GETPOST("type") == '0') {
|
||||
if (!isModEnabled('service')) {
|
||||
$transRecordedType = $langs->trans("LastRecordedProducts", $max);
|
||||
}
|
||||
if (GETPOSTISSET("type") && GETPOST("type") == '1') {
|
||||
if (!isModEnabled('product')) {
|
||||
$transRecordedType = $langs->trans("LastRecordedServices", $max);
|
||||
}
|
||||
|
||||
|
|
@ -346,7 +347,15 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
|
|||
}
|
||||
|
||||
$lastmodified .= '<tr class="liste_titre"><th colspan="'.$colnb.'">'.$transRecordedType.'</th>';
|
||||
$lastmodified .= '<th class="right" colspan="3"><a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC">'.$langs->trans("FullList").'</td>';
|
||||
$lastmodified .= '<th class="right" colspan="3">';
|
||||
$lastmodified .= '<a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC&type=0">';
|
||||
//$lastmodified .= $langs->trans("FullList");
|
||||
$lastmodified .= img_picto($langs->trans("FullList").' - '.$langs->trans("Products"), 'product');
|
||||
$lastmodified .= '</a> ';
|
||||
$lastmodified .= '<a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC&type=1">';
|
||||
//$langs->trans("FullList").'</a>';
|
||||
$lastmodified .= img_picto($langs->trans("FullList").' - '.$langs->trans("Services"), 'service');
|
||||
$lastmodified .= '</th>';
|
||||
$lastmodified .= '</tr>';
|
||||
|
||||
while ($i < $num) {
|
||||
|
|
@ -436,6 +445,104 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
|
|||
}
|
||||
|
||||
|
||||
$latestmovement = '';
|
||||
if (isModEnabled('product')) {
|
||||
$producttmp = new Product($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
|
||||
// Latest movements
|
||||
$sql = "SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,";
|
||||
$sql .= " e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
|
||||
$sql .= " m.rowid as mid, m.value as qty, m.datem, m.batch, m.eatby, m.sellby";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."stock_mouvement as m";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE m.fk_product = p.rowid";
|
||||
$sql .= " AND m.fk_entrepot = e.rowid";
|
||||
$sql .= " AND e.entity IN (".getEntity('stock').")";
|
||||
if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
|
||||
$sql .= " AND p.fk_product_type = ".Product::TYPE_PRODUCT;
|
||||
}
|
||||
$sql .= $db->order("datem", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
dol_syslog("Index:list stock movements", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$latestmovement .= '<div class="div-table-responsive-no-min">';
|
||||
$latestmovement .= '<table class="noborder centpercent">';
|
||||
$latestmovement .= '<tr class="liste_titre">';
|
||||
$latestmovement .= '<th>'.$langs->trans("LastMovements", min($num, $max)).'</th>';
|
||||
$latestmovement .= '<th>'.$langs->trans("Product").'</th>';
|
||||
if (isModEnabled('productbatch')) {
|
||||
$latestmovement .= '<th>'.$langs->trans("Batch").'</th>';
|
||||
}
|
||||
$latestmovement .= '<th>'.$langs->trans("Warehouse").'</th>';
|
||||
$latestmovement .= '<th class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/product/stock/movement_list.php">';
|
||||
$latestmovement .= img_picto($langs->trans("FullList"), 'movement');
|
||||
$latestmovement .= '</a></th>';
|
||||
$latestmovement .= "</tr>\n";
|
||||
|
||||
$tmplotstatic = new Productlot($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $max)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$producttmp->id = $objp->rowid;
|
||||
$producttmp->ref = $objp->produit;
|
||||
$producttmp->status_batch = $objp->tobatch;
|
||||
$producttmp->status_sell = $objp->tosell;
|
||||
$producttmp->status_buy = $objp->tobuy;
|
||||
|
||||
$warehouse->id = $objp->warehouse_id;
|
||||
$warehouse->ref = $objp->warehouse_ref;
|
||||
$warehouse->statut = $objp->warehouse_status;
|
||||
$warehouse->label = $objp->warehouse_label;
|
||||
$warehouse->lieu = $objp->lieu;
|
||||
|
||||
$tmplotstatic->batch = $objp->batch;
|
||||
$tmplotstatic->sellby = $objp->sellby;
|
||||
$tmplotstatic->eatby = $objp->eatby;
|
||||
|
||||
$latestmovement .= '<tr class="oddeven">';
|
||||
$latestmovement .= '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>';
|
||||
$latestmovement .= '<td class="tdoverflowmax150">';
|
||||
$latestmovement .= $producttmp->getNomUrl(1);
|
||||
$latestmovement .= "</td>\n";
|
||||
if (isModEnabled('productbatch')) {
|
||||
$latestmovement .= '<td>';
|
||||
$latestmovement .= $tmplotstatic->getNomUrl(0, 'nolink');
|
||||
$latestmovement .= '</td>';
|
||||
/*if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print '<td>'.dol_print_date($db->jdate($objp->sellby), 'day').'</td>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print '<td>'.dol_print_date($db->jdate($objp->eatby), 'day').'</td>';
|
||||
}*/
|
||||
}
|
||||
$latestmovement .= '<td class="tdoverflowmax150">';
|
||||
$latestmovement .= $warehouse->getNomUrl(1);
|
||||
$latestmovement .= "</td>\n";
|
||||
$latestmovement .= '<td class="right">';
|
||||
if ($objp->qty > 0) {
|
||||
$latestmovement .= '+';
|
||||
}
|
||||
$latestmovement .= $objp->qty.'</td>';
|
||||
$latestmovement .= "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
$latestmovement .= "</table>";
|
||||
$latestmovement .= '</div>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter"
|
||||
// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover":
|
||||
// "commitment engagement" method and "cash accounting" method
|
||||
|
|
@ -468,6 +575,7 @@ $boxlist .= "</div>\n";
|
|||
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
$boxlist .= $lastmodified;
|
||||
$boxlist .= $latestmovement;
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
$boxlist .= '</div>'."\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -216,6 +216,8 @@ body {
|
|||
font-weight: 400;
|
||||
background-color: var(--colorbackbody);
|
||||
<?php print 'direction: '.$langs->trans("DIRECTION").";\n"; ?>
|
||||
/*transform: scale(1.2);
|
||||
transform-origin: 0 0;*/
|
||||
}
|
||||
|
||||
/* Style used to protect html content in output to avoid attack by replacing full page with js content */
|
||||
|
|
@ -3280,6 +3282,7 @@ span.userimg div.userphoto {
|
|||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
padding-top: 1px;
|
||||
display: inline-block;
|
||||
}
|
||||
img.userphotosmall { /* size for user photo in lists */
|
||||
border-radius: 0.6em;
|
||||
|
|
|
|||
|
|
@ -3355,6 +3355,14 @@ img.userphoto { /* size for user photo in lists */
|
|||
background-size: contain;
|
||||
vertical-align: middle;
|
||||
}
|
||||
span.userimg div.userphoto {
|
||||
background-color: #eee;
|
||||
border-radius: 0.72em;
|
||||
width: 1.4em;
|
||||
height: 1.4em;
|
||||
padding-top: 1px;
|
||||
display: inline-block;
|
||||
}
|
||||
img.userphotosmall { /* size for user photo in lists */
|
||||
border-radius: 0.6em;
|
||||
width: 1.2em;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user