diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f600f1a5fcb..48a00919d65 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -10079,14 +10079,15 @@ class Form /** * Output the buttons to submit a creation/edit form * - * @param string $save_label Alternative label for save button - * @param string $cancel_label Alternative label for cancel button - * @param array $morebuttons Add additional buttons between save and cancel - * @param bool $withoutdiv Option to remove enclosing centered div - * @param string $morecss More CSS - * @return string Html code with the buttons + * @param string $save_label Alternative label for save button + * @param string $cancel_label Alternative label for cancel button + * @param array $morebuttons Add additional buttons between save and cancel + * @param bool $withoutdiv Option to remove enclosing centered div + * @param string $morecss More CSS + * @param string $dol_openinpopup If the button are shown in a context of a page shown inside a popup, we put here the string name of popup. + * @return string Html code with the buttons */ - public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '') + public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '', $dol_openinpopup = '') { global $langs; @@ -10124,6 +10125,19 @@ class Form } $retstring .= $withoutdiv ? '': ''; + if ($dol_openinpopup) { + $retstring .= ''."\n"; + $retstring .= ''; + // TODO @LDR for the save button, in action "add", set parent var to return data and close the window + //$retstring .= 'setid '; + //$retstring .= 'setlabel'; + } + return $retstring; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 14281e47a69..8776381b922 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1575,36 +1575,70 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = * Such buttons must be included inside a HTML form. * * @param string $name A name for the html component - * @param string $label Label of button + * @param string $label Label shown in Popup title top bar * @param string $buttonstring button string * @param string $url Url to open * @param string $disabled Disabled text + * @param string $morecss More CSS + * @param string $backtopagejsfields The back to page must be managed using javascript instead of a redirect. + * Value is 'Name of html component to set with id:Name of html component to set with label' + * TODO Support this mode, for example when used from the page create a project on thirdparty creation. * @return string HTML component with button */ -function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '') +function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '', $morecss = 'button bordertransp', $backtopagejsfields = '') { if (strpos($url, '?') > 0) { - $url .= '&dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup=1'; + $url .= '&dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup='.urlencode($name); } else { - $url .= '?dol_hide_menuinpopup=1&dol_hide_leftmenu=1&dol_openinpopup=1'; + $url .= '?dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup='.urlencode($name); + } + + $out .= ''; + + $backtopagejsfieldsid = ''; $backtopagejsfieldslabel = ''; + if ($backtopagejsfields) { + $url .= '&backtopagejsfields='.urlencode($backtopagejsfields); + $tmpbacktopagejsfields = explode(':', $backtopagejsfields); + $backtopagejsfieldsid = empty($tmpbacktopagejsfields[0]) ? '' : $tmpbacktopagejsfields[0]; + $backtopagejsfieldslabel = empty($tmpbacktopagejsfields[1]) ? '' : $tmpbacktopagejsfields[1]; } //print ''; - $out = ''.$buttonstring.''; + $out .= ''."\n"; + $out .= ''.$buttonstring.''; + $out .= ''; + $out .= ''; + $out .= ''; $out .= ''; $out .= ''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 21218f099fe..4581814f0f8 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1367,11 +1367,11 @@ if (!function_exists("llxHeader")) { print ''."\n"; // top menu and left menu area - if (empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) { + if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && !GETPOST('dol_openinpopup', 'aZ09')) { top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url); } - if (empty($conf->dol_hide_leftmenu)) { + if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) { left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retrieved with a global $menumanager inside this function } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 6d5c807c3f0..002685415cc 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -87,13 +87,15 @@ $langs->loadLangs(array("mymodule@mymodule", "other")); // Get parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); +$lineid = GETPOST('lineid', 'int'); + $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -$lineid = GETPOST('lineid', 'int'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); // Initialize technical objects $object = new MyObject($db); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index c5fc08a6402..6a27472a7e3 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -46,8 +46,11 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'aZ09'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); + $status = GETPOST('status', 'int'); $opp_status = GETPOST('opp_status', 'int'); $opp_percent = price2num(GETPOST('opp_percent', 'alpha')); @@ -505,9 +508,10 @@ if ($action == 'create' && $user->rights->projet->creer) { print load_fiche_titre($titlenew, '', 'project'); print '
'; - print ''; print ''; + print ''; print ''; + print ''; print dol_get_fiche_head(); @@ -605,7 +609,7 @@ if ($action == 'create' && $user->rights->projet->creer) { if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) { $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; } - $text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx'); + $text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filteronlist, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) { $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1); @@ -613,7 +617,12 @@ if ($action == 'create' && $user->rights->projet->creer) { print $text; } if (!GETPOSTISSET('backtopage')) { - print ' '; + $url = '/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create'); + $newbutton = ''; + // TODO @LDR Impletment this + //$tmpbacktopagejsfields = 'socid:search_socid'; + //print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', $tmpbacktopagejsfields); + print ' '.$newbutton.''; } print ''; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 154a376cca7..cbb8de3cf28 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -84,7 +84,9 @@ $error = 0; $errors = array(); $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); +$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); @@ -1262,8 +1264,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Chrome ignor autocomplete print ''; - print ''; print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -1721,7 +1724,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print dol_get_fiche_end(); - print $form->buttonsSaveCancel("AddThirdParty"); + print $form->buttonsSaveCancel("AddThirdParty", 'Cancel', null, 0, '', $dol_openinpopup); print '
'."\n"; } elseif ($action == 'edit') { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index d454ec8f532..02926e2add8 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -68,6 +68,9 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int'); +$dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); $type_container = GETPOST('WEBSITE_TYPE_CONTAINER', 'alpha'); @@ -2558,6 +2561,7 @@ print ''."\n"; print '
'; print ''; print ''; +print ''; if ($action == 'createsite') { print ''; @@ -2638,7 +2642,7 @@ if (!GETPOST('hide_websitemenu')) { //var_dump($objectpage);exit; - print '
'; + print '
'; // // Toolbar for websites