diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index cae98408d44..fa29b8187fb 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -79,6 +79,7 @@ $cancel = GETPOST('cancel', 'alpha'); $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $lineid = GETPOST('lineid', 'int'); $contactid = GETPOST('contactid', 'int'); $projectid = GETPOST('projectid', 'int'); @@ -1774,6 +1775,7 @@ if ($action == 'create') { print '
'; print ''; print ''; + print ''; if ($origin != 'project' && $originid) { print ''; print ''; @@ -2449,6 +2451,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print $form->selectDate($object->date, 're', '', '', 0, "editdate"); print ''; print '
'; @@ -2476,6 +2479,7 @@ if ($action == 'create') { print '
'; print ''; print ''; + print ''; print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance"); print ''; print '
'; @@ -2836,6 +2840,7 @@ if ($action == 'create') { + '; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b58a74ae67a..602e41d08e1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -84,6 +84,8 @@ $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + $lineid = GETPOST('lineid', 'int'); $contactid = GETPOST('contactid', 'int'); $projectid = GETPOST('projectid', 'int'); @@ -1755,6 +1757,7 @@ if ($action == 'create' && $usercancreate) { print ''; print ''; print ''; + print ''; if (!empty($currency_tx)) { print ''; } @@ -2449,6 +2452,7 @@ if ($action == 'create' && $usercancreate) { print '
'; print ''; print ''; + print ''; print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); print ''; print '
'; @@ -2470,6 +2474,7 @@ if ($action == 'create' && $usercancreate) { print '
'; print ''; print ''; + print ''; print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; @@ -2763,7 +2768,9 @@ if ($action == 'create' && $usercancreate) { - '; + + + '; if (!empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e8e92ebfada..58c7e35724d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -86,6 +86,8 @@ $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + $lineid = GETPOST('lineid', 'int'); $userid = GETPOST('userid', 'int'); $search_ref = GETPOST('sf_ref', 'alpha') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); @@ -3153,6 +3155,8 @@ if ($action == 'create') { if ($soc->id > 0) { print ''."\n"; } + print ''; + print ''; print ''; print ''; print ''; @@ -4688,6 +4692,7 @@ if ($action == 'create') { print '
'; print ''; print ''; + print ''; print ''; print ''; print '
'; @@ -4717,6 +4722,7 @@ if ($action == 'create') { print '
'; print ''; print ''; + print ''; $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement; $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; @@ -4752,6 +4758,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print ''; print ''; print '
'; @@ -4832,6 +4839,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code); print ' → '; print ' '; @@ -5371,6 +5379,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print ''; @@ -5409,6 +5418,7 @@ if ($action == 'create') { + '; if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 2817cfc406a..7e5b4d482d0 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -56,6 +56,7 @@ $langs->loadLangs(array("contracts", "orders", "companies", "bills", "products", $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); $socid = GETPOST('socid', 'int'); $id = GETPOST('id', 'int'); @@ -1135,10 +1136,10 @@ if ($action == 'create') { print ''; print ''; - print ''; print ''."\n"; print ''; + print ''; print dol_get_fiche_head(); @@ -1350,6 +1351,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; } // Contract card @@ -1490,6 +1492,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print ''; print ''; @@ -1914,6 +1917,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -1973,6 +1977,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print '
'; @@ -2038,6 +2043,7 @@ if ($action == 'create') { + '; print '
'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 36470668f43..bc26eb96553 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10869,8 +10869,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * * @param string $label Label or tooltip of button. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. * @param string $text Optional : short label on button. Can be escaped HTML content or full simple text. - * @param string $actionType 'default', 'delete', 'danger' - * @param string $url Url for link + * @param string $actionType 'default', 'delete', 'danger', 'email', ... + * @param string|array $url Url for link or array of subbutton description * @param string $id Attribute id of button * @param int|boolean $userRight User action right * // phpcs:disable @@ -10897,7 +10897,26 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = { global $hookmanager, $action, $object, $langs; - //var_dump($params); + // If $url is an array, we must build a dropdown button + if (is_array($url)) { + $out = '"; + + return $out; + } + + // If $url is a simple link if (!empty($params['isDropdown'])) $class = "dropdown-item"; else { diff --git a/htdocs/don/card.php b/htdocs/don/card.php index a077c703fda..2c3e3ec6e11 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -52,6 +52,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); $socid = GETPOST('socid', 'int'); $amount = price2num(GETPOST('amount', 'alphanohtml'), 'MT'); $donation_date = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); @@ -405,6 +406,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print dol_get_fiche_head(''); @@ -579,7 +581,7 @@ if (!empty($id) && $action == 'edit') { print ''; print ''; print ''; - + print ''; print dol_get_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation'); @@ -732,6 +734,7 @@ if (!empty($id) && $action != 'edit') { $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; + $morehtmlref .= ''; $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); $morehtmlref .= ''; $morehtmlref .= ''; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 7dd54308af4..168e7461427 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -55,6 +55,7 @@ $langs->loadLangs(array("trips", "bills", "mails")); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); $id = GETPOST('id', 'int'); $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int')); @@ -1407,6 +1408,7 @@ if ($action == 'create') { print '
'; print ''; print ''; + print ''; print dol_get_fiche_head(''); @@ -1545,6 +1547,7 @@ if ($action == 'create') { print "\n"; print ''; print ''; + print ''; print dol_get_fiche_head($head, 'card', $langs->trans("ExpenseReport"), 0, 'trip'); @@ -2027,6 +2030,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print '
'; print '
'; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 0f18d024671..31ae0ccaf65 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -62,6 +62,8 @@ $contratid = (int) GETPOST('contratid', 'int'); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + $mesg = GETPOST('msg', 'alpha'); $origin = GETPOST('origin', 'alpha'); $originid = (GETPOST('originid', 'int') ?GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility @@ -890,6 +892,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print dol_get_fiche_head(''); @@ -1043,6 +1046,7 @@ if ($action == 'create') { print ''; print ''; print ''; // We go back to create action + print ''; print dol_get_fiche_head(''); @@ -1308,6 +1312,7 @@ if ($action == 'create') { } else { print ''; } + print ''; // Intervention lines $sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang,'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 30e6ceda91e..5408b8f980a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -74,6 +74,8 @@ $action = GETPOST('action', 'aZ09'); $confirm = GETPOST("confirm"); $ref = GETPOST('ref', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + $lineid = GETPOST('lineid', 'int'); $projectid = GETPOST('projectid', 'int'); $origin = GETPOST('origin', 'alpha'); @@ -2156,6 +2158,7 @@ if ($action == 'create') { if (!empty($currency_tx)) { print ''; } + print ''; print dol_get_fiche_head(); @@ -3721,6 +3724,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; if (!empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ea360315fba..ab9d45a6a81 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2454,27 +2454,39 @@ function top_menu_user($hideloginname = 0, $urllogout = '') } jQuery(document).ready(function() { jQuery(document).on("click", function(event) { + // console.log("Click somewhere on screen"); if (!$(event.target).closest("#topmenu-login-dropdown").length) { closeTopMenuLoginDropdown(); } }); - '; + + jQuery(".butAction.dropdown-toggle").on("click", function(event) { + console.log("Click on .butAction.dropdown-toggle"); + var parentholder = jQuery(".butAction.dropdown-toggle").closest(".dropdown"); + var offset = parentholder.offset(); + var left = offset.left; + var right = $(document).width() - offset.left - parentholder.width(); + parentholder.toggleClass("open"); + parentholder.children(".dropdown-content").css({"right": right+"px", "left": "auto"}); + }); + '; + if ($conf->theme != 'md') { $btnUser .= ' jQuery("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) { - console.log("toggle login dropdown"); + console.log("Click on #topmenu-login-dropdown .dropdown-toggle"); event.preventDefault(); jQuery("#topmenu-login-dropdown").toggleClass("open"); }); jQuery("#topmenulogincompanyinfo-btn").on("click", function() { - console.log("Clik on topmenulogincompanyinfo-btn"); + console.log("Clik on #topmenulogincompanyinfo-btn"); jQuery("#topmenulogincompanyinfo").slideToggle(); }); jQuery("#topmenuloginmoreinfo-btn").on("click", function() { - console.log("Clik on topmenuloginmoreinfo-btn"); + console.log("Clik on #topmenuloginmoreinfo-btn"); jQuery("#topmenuloginmoreinfo").slideToggle(); });'; } @@ -2515,6 +2527,7 @@ function top_menu_quickadd() } }); $("#topmenu-quickadd-dropdown .dropdown-toggle").on("click", function(event) { + console.log("Click on #topmenu-quickadd-dropdown .dropdown-toggle"); openQuickAddDropDown(); }); // Key map shortcut @@ -2762,7 +2775,7 @@ function top_menu_bookmark() }); jQuery("#topmenu-bookmark-dropdown .dropdown-toggle").on("click", function(event) { - console.log("toggle bookmark dropdown"); + console.log("Click on #topmenu-bookmark-dropdown .dropdown-toggle"); openBookMarkDropDown(); }); @@ -2904,7 +2917,7 @@ function top_menu_search() // Open drop down jQuery("#topmenu-global-search-dropdown .dropdown-toggle").on("click", function(event) { - console.log("toggle search dropdown"); + console.log("click on toggle #topmenu-global-search-dropdown .dropdown-toggle"); openGlobalSearchDropDown(); }); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 36bc7b87961..bc31f211a63 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1551,56 +1551,26 @@ if ($action == 'create' && $user->rights->projet->creer) { } } + // Buttons Create + if (empty($conf->global->PROJECT_HIDE_CREATE_OBJECT_BUTTON)) { + $arrayforbutaction = array( + 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("commande"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 30 => array('lang'=>'bills', 'enabled'=>isModEnabled("facture"), 'perm'=>$user->hasRight('facture', 'creer'), 'label' => 'CreateBill', 'url'=>'/compta/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 40 => array('lang'=>'supplier_proposal', 'enabled'=>isModEnabled("supplier_proposal"), 'perm'=>$user->hasRight('supplier_proposal', 'creer'), 'label' => 'AddSupplierProposal', 'url'=>'/supplier_proposal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 50 => array('lang'=>'suppliers', 'enabled'=>isModEnabled("supplier_order"), 'perm'=>$user->hasRight('fournisseur', 'commande', 'creer'), 'label' => 'AddSupplierOrder', 'url'=>'/fourn/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 60 => array('lang'=>'suppliers', 'enabled'=>isModEnabled("supplier_invoice"), 'perm'=>$user->hasRight('fournisseur', 'facture', 'creer'), 'label' => 'AddSupplierInvoice', 'url'=>'/fourn/facture/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 70 => array('lang'=>'interventions', 'enabled'=>isModEnabled("ficheinter"), 'perm'=>$user->hasRight('fichinter', 'creer'), 'label' => 'AddIntervention', 'url'=>'/fichinter/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 80 => array('lang'=>'contrats', 'enabled'=>isModEnabled("contrat"), 'perm'=>$user->hasRight('contrat', 'creer'), 'label' => 'AddContract', 'url'=>'/contrat/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 90 => array('lang'=>'trips', 'enabled'=>isModEnabled("expensereport"), 'perm'=>$user->hasRight('expensereport', 'creer'), 'label' => 'AddTrip', 'url'=>'/expensereport/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + 100 => array('lang'=>'donations', 'enabled'=>isModEnabled("don"), 'perm'=>$user->hasRight('don', 'creer'), 'label' => 'AddDonation', 'url'=>'/don/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), + ); - if (!empty($conf->global->PROJECT_SHOW_CREATE_OBJECT_BUTTON)) { - print'"; + $params = array('backtopage' => $_SERVER["PHP_SELF"].'?id='.$object->id); + + print dolGetButtonAction($langs->trans("Create"), '', 'default', $arrayforbutaction, '', 1, $params); } + // Clone if ($user->rights->projet->creer) { if ($userWrite > 0) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 9baa56d8193..79520727955 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -63,6 +63,9 @@ $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); + $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); @@ -1251,6 +1254,7 @@ if ($action == 'create') { print ''; print ''; } + print ''; print dol_get_fiche_head(); @@ -1688,6 +1692,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ''; print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); print ''; print ''; @@ -1889,6 +1894,7 @@ if ($action == 'create') { + '; if (!empty($conf->use_javascript_ajax) && $object->statut == SupplierProposal::STATUS_DRAFT) { diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index b3f91901575..034b9974c23 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -501,6 +501,43 @@ div.quickaddblock:focus { background: ; } + +/* for the dropdown on action buttons */ +dropdown-holder { + position: relative; + display: inline-block; +} + +.dropdown-content { + display: none; + position: absolute; + z-index: 1; + width: 300px; + right:10px; /* will be set with js */ + background: #fff; + border: 1px solid #bbb; + text-align: +} + +.dropdown-content a { + margin-right: auto !important; + margin-left: auto !important; +} +.dropdown-content .butAction { + background: none; + color: #000 !important; +} +.dropdown-content .butAction:hover { + box-shadow: none; + text-decoration: underline; +} + +.dropdown-holder.open .dropdown-content { + display: block; +} + + + /* smartphone */ @media only screen and (max-width: 767px) { diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index eb1fd668361..a0d010a4461 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -435,6 +435,41 @@ a.dropdown-item { } +/* for the dropdown on action buttons */ +dropdown-holder { + position: relative; + display: inline-block; +} + +.dropdown-content { + display: none; + position: absolute; + z-index: 1; + width: 300px; + right:10px; /* will be set with js */ + background: #fff; + border: 1px solid #bbb; + text-align: +} + +.dropdown-content a { + margin-right: auto !important; + margin-left: auto !important; +} +.dropdown-content .butAction { + background: none; + color: #000 !important; +} +.dropdown-content .butAction:hover { + box-shadow: none; + text-decoration: underline; +} + +.dropdown-holder.open .dropdown-content { + display: block; +} + + /* smartphone */ @media only screen and (max-width: 767px) {