diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 83fd8d47c4f..a74f9c4c5a8 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -367,7 +367,7 @@ if ($action == 'update') { $computedvalue, (GETPOST('entitycurrentorall', 'alpha') ? 0 : ''), GETPOST('langfile'), - GETPOST('enabled', 'alpha'), + GETPOST('enabled', 'nohtml'), (GETPOST('totalizable', 'alpha') ? 1 : 0), GETPOST('printable', 'alpha'), array('css' => $css, 'cssview' => $cssview, 'csslist' => $csslist) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index aeb58d34c0f..97abd91d8b2 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -431,6 +431,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($featureforlistofmodule == 'produit') { $featureforlistofmodule = 'product'; } + if ($featureforlistofmodule == 'supplier_proposal') { + $featureforlistofmodule = 'supplierproposal'; + } if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users $readok = 0; $nbko++; @@ -811,10 +814,13 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $feature = 'projet_task'; } + if ($feature == 'payment_sc') { + $feature = "chargesociales"; + } $checkonentitydone = 0; // Array to define rules of checks to do - $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company) + $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment','chargesociales'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for object Societe $checkother = array('contact', 'agenda', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 2e8511acf8e..093af43a635 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -143,7 +143,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con - + diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 288f3b8f72e..9b4fa75c751 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -13,13 +13,28 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { - print ''; - if (isset($totalarray['type']) && $totalarray['type'][$i] == 'duration') { - print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0); - } else { - print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0); + switch ($totalarray['type'][$i]) { + case 'duration'; + print ''; + print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0); + print ''; + break; + case 'string'; + print ''; + print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : ''); + print ''; + break; + case 'stock'; + print ''; + print price2num(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0, 'MS'); + print ''; + break; + default; + print ''; + print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0); + print ''; + break; } - print ''; } else { if ($i == 1) { if (is_null($limit) || $num < $limit) { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index ac740974d88..1412ea2fcf5 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -595,35 +595,60 @@ if ($action == 'create') { print '
'; + $totalarray = array(); + $totalarray['val'] = array (); + $totalarray['pos'] = array (); + $totalarray['type'] = array (); + $totalarray['nbfield'] = 0; + // TODO Create $arrayfields with all fields to show print ''; print ""; - $parameters = array(); + $parameters = array('totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + print_liste_field_titre("Product", "", "p.ref", "&id=".$id, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", "", "p.label", "&id=".$id, "", "", $sortfield, $sortorder); print_liste_field_titre("NumberOfUnit", "", "ps.reel", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield'] += 3; + $totalarray['pos'][$totalarray['nbfield']] = 'totalunit'; + $totalarray['type'][$totalarray['nbfield']] = 'stock'; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { print_liste_field_titre("Unit", "", "p.fk_unit", "&id=".$id, "", 'align="left"', $sortfield, $sortorder); + $totalarray['nbfield']++; + $totalarray['pos'][$totalarray['nbfield']] = 'units'; + $totalarray['type'][$totalarray['nbfield']] = 'string'; } + print_liste_field_titre($form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")), "", "p.pmp", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; + print_liste_field_titre("EstimatedStockValueShort", "", "", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; + $totalarray['pos'][$totalarray['nbfield']] = 'totalvalue'; + if (empty($conf->global->PRODUIT_MULTIPRICES)) { print_liste_field_titre("SellPriceMin", "", "p.price", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; } if (empty($conf->global->PRODUIT_MULTIPRICES)) { print_liste_field_titre("EstimatedStockValueSellShort", "", "", "&id=".$id, "", '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; + $totalarray['pos'][$totalarray['nbfield']] = 'totalvaluesell'; } if ($user->rights->stock->mouvement->creer) { print_liste_field_titre(''); + $totalarray['nbfield']++; } if ($user->rights->stock->creer) { print_liste_field_titre(''); + $totalarray['nbfield']++; } // Hook fields - $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array('sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print "\n"; @@ -708,7 +733,7 @@ if ($action == 'create') { //print ''; print ''; - $parameters = array('obj'=>$objp); + $parameters = array('obj'=>$objp, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -807,34 +832,20 @@ if ($action == 'create') { } $db->free($resql); - // Total - print ''; - print ''; - print ''; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) { - print ''; - print ''; + $totalarray['val']['totalunit'] = $totalunit; + $totalarray['val']['totalvalue'] = price2num($totalvalue, 'MT'); + $totalarray['val']['totalvaluesell'] = price2num($totalvaluesell, 'MT'); + $totalarray['val']['units'] = $langs->trans($productstatic->getLabelOfUnit()); + + $parameters = array('totalarray' => &$totalarray); + // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListTotal', $parameters, $object); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors); } - if ($user->rights->stock->mouvement->creer) { - print ''; - } - - if ($user->rights->stock->creer) { - print ''; - } - - print ''; + // Show total line + include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; } else { dol_print_error($db); }
'.dol_print_date($objp->datem).'
'.$langs->trans("Total").''; - $valtoshow = price2num($totalunit, 'MS'); - if (empty($conf->global->PRODUCT_USE_UNITS) || $sameunits) { - print empty($valtoshow) ? '0' : $valtoshow; - } - print ''; - if (empty($conf->global->PRODUCT_USE_UNITS) && $sameunits) { - print $langs->trans($productstatic->getLabelOfUnit()); - } - print ''.price(price2num($totalvalue, 'MT')).' '.price(price2num($totalvaluesell, 'MT')).'