From b3c903723f3e3335be8f8a8fe426cd5312c846b3 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 11:37:08 +0200 Subject: [PATCH] Add menu and clean --- htdocs/commande/list_line.php | 33 +++++++------------------ htdocs/core/menus/standard/eldy.lib.php | 3 +++ htdocs/langs/en_US/orders.lang | 1 + 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/htdocs/commande/list_line.php b/htdocs/commande/list_line.php index ac1885b03af..219d8745587 100644 --- a/htdocs/commande/list_line.php +++ b/htdocs/commande/list_line.php @@ -75,7 +75,6 @@ $search_product_category = GETPOST('search_product_category', 'int'); // Détail commande $search_refProduct = GETPOST('search_refProduct', 'alpha'); $search_descProduct = GETPOST('search_descProduct', 'alpha'); -$check_orderdetail = GETPOST('check_orderdetail', 'alpha'); $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha'); $search_ref_customer = GETPOST('search_ref_customer', 'alpha'); @@ -169,6 +168,10 @@ if (empty($user->socid)) { $checkedtypetiers = 0; $arrayfields = array( + // Détail commande + 'pr.ref'=> array('label'=>'ProductRef', 'checked'=>1, 'position'=>1), + 'pr.desc'=> array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1), + 'cdet.qty'=> array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1), 'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5), 'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10), 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>-1, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>20), @@ -211,13 +214,6 @@ $arrayfields = array( 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) ); -// Détail commande -if (!empty($check_orderdetail)) { - $arrayfields['cdet.qty'] = array('label'=>'QtyOrdered', 'checked'=>1, 'position'=>1); - $arrayfields['pr.desc'] = array('label'=>'ProductDescription', 'checked'=>1, 'position'=>1); - $arrayfields['pr.ref'] = array('label'=>'ProductRef', 'checked'=>1, 'position'=>1); -} - // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -810,10 +806,8 @@ $sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shippin $sql .= ' c.fk_input_reason, c.import_key'; // Détail commande -if (!empty($check_orderdetail)) { - $sql .= ', cdet.description, cdet.qty, '; - $sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; -} +$sql .= ', cdet.description, cdet.qty, '; +$sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ", cc.fk_categorie, cc.fk_soc"; @@ -837,13 +831,9 @@ if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { } // Détail commande -if (!empty($check_orderdetail)) { - $sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product'; -} else { - $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; -} +$sql .= ', '.MAIN_DB_PREFIX.'commandedet as cdet'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON cdet.fk_commande=c.rowid'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product'; if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; @@ -1353,11 +1343,6 @@ if ($resql) { print '
'; } - // Détail commande - if (!empty($conf->global->ORDER_ADD_OPTION_SHOW_DETAIL_LIST)) { - print '
 
'; - } - if ($sall) { foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4707657d3e3..e4e6c8e2839 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1324,6 +1324,9 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($user->socid)) { + $newmenu->add("/commande/list_line.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->rights->commande->lire); + } $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); } diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 78a5e348516..cb64d1b603a 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -96,6 +96,7 @@ OrdersStatisticsSuppliers=Purchase order statistics NumberOfOrdersByMonth=Number of orders by month AmountOfOrdersByMonthHT=Amount of orders by month (excl. tax) ListOfOrders=List of orders +ListOrderLigne=Lines of orders CloseOrder=Close order ConfirmCloseOrder=Are you sure you want to set this order to delivered? Once an order is delivered, it can be set to billed. ConfirmDeleteOrder=Are you sure you want to delete this order?