From cf74e5b9a8e36f18cdb70e131a36d2ab349ac628 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 00:25:10 +0100 Subject: [PATCH 01/14] Change order of tabs --- htdocs/core/lib/project.lib.php | 76 ++++++++++++++++----------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 84d3272568237..8b6ca6a5ca35b 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -52,9 +52,44 @@ function project_prepare_head($object) $head[$h][2] = 'contact'; $h++; + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + // Then tab for sub level of projet, i mean tasks + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id; + $head[$h][1] = $langs->trans("Tasks"); + + require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; + $taskstatic=new Task($db); + $nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); + if ($nbTasks > 0) $head[$h][1].= ' '.($nbTasks).''; + $head[$h][2] = 'tasks'; + $h++; + + $nbTimeSpent=0; + $sql = "SELECT t.rowid"; + //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; + //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt"; + $sql .= " WHERE t.fk_task = pt.rowid"; + $sql .= " AND pt.fk_projet =".$object->id; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) $nbTimeSpent=1; + } + else dol_print_error($db); + + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; + $head[$h][1] = $langs->trans("TimeSpent"); + if ($nbTimeSpent > 0) $head[$h][1].= ' ...'; + $head[$h][2] = 'timespent'; + $h++; + } + if (! empty($conf->fournisseur->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) - || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) - || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) + || ! empty($conf->facture->enabled) || ! empty($conf->contrat->enabled) + || ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; $head[$h][1] = $langs->trans("ProjectOverview"); @@ -92,41 +127,6 @@ function project_prepare_head($object) $head[$h][2] = 'document'; $h++; - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - // Then tab for sub level of projet, i mean tasks - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id; - $head[$h][1] = $langs->trans("Tasks"); - - require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; - $taskstatic=new Task($db); - $nbTasks=count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); - if ($nbTasks > 0) $head[$h][1].= ' '.($nbTasks).''; - $head[$h][2] = 'tasks'; - $h++; - - $nbTimeSpent=0; - $sql = "SELECT t.rowid"; - //$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; - //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt"; - $sql .= " WHERE t.fk_task = pt.rowid"; - $sql .= " AND pt.fk_projet =".$object->id; - $resql = $db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - if ($obj) $nbTimeSpent=1; - } - else dol_print_error($db); - - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; - $head[$h][1] = $langs->trans("TimeSpent"); - if ($nbTimeSpent > 0) $head[$h][1].= ' ...'; - $head[$h][2] = 'timespent'; - $h++; - } - // Manage discussion if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) { @@ -1205,7 +1205,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ { continue; } - + // Break on a new project if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { From 3f912ebfff954d60d49105aa3ced23e1865fd80e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 11:19:52 +0100 Subject: [PATCH 02/14] FIX restore security event login/logout --- htdocs/core/class/events.class.php | 4 +- .../interface_20_all_Logevents.class.php | 4 +- htdocs/main.inc.php | 61 ++++++++++++++++++- htdocs/user/logout.php | 13 ++-- 4 files changed, 70 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 78439af1134a0..68e029dae4b67 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -76,9 +76,9 @@ class Events // extends CommonObject // List of all Audit/Security events supported by triggers public $eventstolog=array( - /*array('id'=>'USER_LOGIN', 'test'=>1), + array('id'=>'USER_LOGIN', 'test'=>1), array('id'=>'USER_LOGIN_FAILED', 'test'=>1), - array('id'=>'USER_LOGOUT', 'test'=>1),*/ + array('id'=>'USER_LOGOUT', 'test'=>1), array('id'=>'USER_CREATE', 'test'=>1), array('id'=>'USER_MODIFY', 'test'=>1), array('id'=>'USER_NEW_PASSWORD', 'test'=>1), diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 4d5d7e74280b7..b2100b806fbed 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -70,7 +70,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf $date = dol_now(); // Actions - /*if ($action == 'USER_LOGIN') + if ($action == 'USER_LOGIN') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -97,7 +97,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf // Initialisation donnees (date,duree,texte,desc) $text="(UserLogoff,".$object->login.")"; $desc="(UserLogoff,".$object->login.")"; - }*/ + } if ($action == 'USER_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 06f67a9b79fd8..438fff1eb15e0 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -500,6 +500,17 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadValueForCode"); $test=false; + // Call trigger for the "security events" log + $user->trigger_mesg='ErrorBadValueForCode - login='.GETPOST("username","alpha",2); + // Call of triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); + if ($result < 0) { + $error++; + } + // End Call of triggers + // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -568,6 +579,17 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions if (empty($_SESSION["dol_loginmesg"])) $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); + // Call trigger for the "security events" log + $user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username","alpha",2); + // Call of triggers + include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST("username","alpha",2)); + if ($result < 0) { + $error++; + } + // End Call of triggers + // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -604,12 +626,25 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login); + + $user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; + + $user->trigger_mesg=$user->error; } + // Call triggers for the "security events" log + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); + if ($result < 0) { + $error++; + } + // End call triggers + // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -648,12 +683,25 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login); + + $user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; + + $user->trigger_mesg=$user->error; } + // Call triggers for the "security events" log + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); + if ($result < 0) { + $error++; + } + // End call triggers + // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -741,6 +789,17 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"]; + // Call triggers for the "security events" log + $user->trigger_mesg = $loginfo; + // Call triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers('USER_LOGIN',$user,$user,$langs,$conf); + if ($result < 0) { + $error++; + } + // End call triggers + // Hooks on successfull login $action=''; $hookmanager->initHooks(array('login')); @@ -752,7 +811,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) { $db->rollback(); session_destroy(); - dol_print_error($db,'Error in some hooks afterLogin'); + dol_print_error($db,'Error in some triggers USER_LOGIN or in some hooks afterLogin'); exit; } else diff --git a/htdocs/user/logout.php b/htdocs/user/logout.php index 3f53a4c67dd82..668ca6fa4dbee 100644 --- a/htdocs/user/logout.php +++ b/htdocs/user/logout.php @@ -41,13 +41,12 @@ global $conf, $langs, $user; -// Appel des triggers -// TODO @deprecated Remove this. Hook must be used, not this trigger. -//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; -//$interface=new Interfaces($db); -//$result=$interface->run_triggers('USER_LOGOUT',$user,$user,$langs,$conf); -//if ($result < 0) { $error++; } -// Fin appel triggers +// Call triggers for the "security events" log +include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; +$interface=new Interfaces($db); +$result=$interface->run_triggers('USER_LOGOUT',$user,$user,$langs,$conf); +if ($result < 0) { $error++; } +// End call triggers // Hooks on logout $action=''; From 188cda7902fab5b92735dac9c109cb2a9b2810b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 12:32:26 +0100 Subject: [PATCH 03/14] Fix look and feel v9 --- htdocs/projet/tasks/contact.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 82c722f24858d..e6de0743d6620 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -326,7 +326,7 @@ dol_fiche_end(); /* - * Lignes de contacts + * Lines of contacts */ /* // Contacts lines (modules that overwrite templates must declare this into descriptor) @@ -340,16 +340,15 @@ /* * Add a new contact line - * Non affiche en mode modification de ligne */ print ''; if ($action != 'editline' && $user->rights->projet->creer) { print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print "\n"; @@ -507,7 +506,7 @@ { print ' '; print ''; - print img_delete(); + print img_picto($langs->trans('Unlink'), 'unlink'); print ''; } print ''; From af5b63954ad13635658b3ceeeaf333a4d921e56f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 12:49:20 +0100 Subject: [PATCH 04/14] Clean code --- htdocs/core/class/html.formprojet.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 1b6efe568200f..35b3e52d1542a 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -334,7 +334,7 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, $out=''; $hideunselectables = false; - if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; if (empty($projectsListId)) { @@ -346,11 +346,11 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, } // Search all projects - $sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,'; + $sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public,'; $sql.= ' s.nom as name'; $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc'; - $sql.= ', '.MAIN_DB_PREFIX.'projet_task as t'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,'; + $sql.= ' '.MAIN_DB_PREFIX.'projet_task as t'; $sql.= " WHERE p.entity IN (".getEntity('project').")"; $sql.= " AND t.fk_projet = p.rowid"; if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")"; @@ -393,7 +393,7 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, } else { - if ($discard_closed == 1 && $obj->fk_statut == 2) + if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED) { $i++; continue; @@ -411,12 +411,12 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, if ($obj->name) $labeltoshow.=' ('.$obj->name.')'; $disabled=0; - if ($obj->fk_statut == 0) + if ($obj->fk_statut == Project::STATUS_DRAFT) { $disabled=1; $labeltoshow.=' - '.$langs->trans("Draft"); } - else if ($obj->fk_statut == 2) + else if ($obj->fk_statut == Project::STATUS_CLOSED) { if ($discard_closed == 2) $disabled=1; $labeltoshow.=' - '.$langs->trans("Closed"); From dbee87aa9d5382aca24092effabe66d56dbe3570 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 13:10:28 +0100 Subject: [PATCH 05/14] Trans --- htdocs/langs/en_US/projects.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 75987cc621ebd..1e1f8bb2d087f 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -224,7 +224,7 @@ AllowToLinkFromOtherCompany=Allow to link project from other company

S LatestProjects=Latest %s projects LatestModifiedProjects=Latest %s modified projects OtherFilteredTasks=Other filtered tasks -NoAssignedTasks=No assigned tasks (assign project/tasks the current user from the top select box to enter time on it) +NoAssignedTasks=No assigned tasks found (assign project/tasks the current user from the top select box to enter time on it) # Comments trans AllowCommentOnTask=Allow user comments on tasks AllowCommentOnProject=Allow user comments on projects From e2e22f95d1fada0ad21dace47c6bede1620d16ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 13:18:34 +0100 Subject: [PATCH 06/14] FIX Workaround for flex bug --- htdocs/theme/eldy/style.css.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 4afac8ac2cc64..05fd488e948f6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -907,8 +907,9 @@ min-width: 150px; } .thumbstat150 { - /* min-width: 170px; */ - width: 170px; + min-width: 170px; + max-wdith: 171px; + /* width: 170px; If I use with, there is trouble on size of flex boxes solved with min+max that is a little bit higer than min */ } .thumbstat, .thumbstat150 { browser->name == 'ie') { ?> From 853566cc28cbbffe587671574e8cda34f8699298 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 14:40:42 +0100 Subject: [PATCH 07/14] Fix bold chars in tooltips --- htdocs/exports/export.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 7cb69ee9a3f9d..b715ba853b7d6 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -623,11 +623,11 @@ } if (! empty($objexport->array_export_examplevalues[0][$code])) { - $htmltext.=$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; + $htmltext.=''.$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; } if (! empty($objexport->array_export_TypeFields[0][$code])) { - $htmltext.=$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; + $htmltext.=''.$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; } if (isset($array_selected[$code]) && $array_selected[$code]) From f3a67d6c3f72b33eade7380f45865d30903d505a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 15:06:54 +0100 Subject: [PATCH 08/14] FIX Show warning when trying to create task on closed project --- htdocs/langs/en_US/errors.lang | 1 + htdocs/projet/tasks.php | 190 +++++++++++++++++---------------- 2 files changed, 101 insertions(+), 90 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a5555f85c8259..4bb9fcf2dec33 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -235,3 +235,4 @@ WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security pur WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to %s when using the mass actions on lists WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report +WarningProjectClosed=Project is closed. You must re-open it before. \ No newline at end of file diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2f06f698b14c0..e8e40dba81447 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -450,108 +450,118 @@ print load_fiche_titre($langs->trans("NewTask"), '', 'title_project'); - print '
'; - print ''; - print ''; - print ''; - if (! empty($object->id)) print ''; + if ($object->statut == Project::STATUS_CLOSED) + { + print '
'; + $langs->load("errors"); + print $langs->trans("WarningProjectClosed"); + print '
'; + } + else + { + print ''; + print ''; + print ''; + print ''; + if (! empty($object->id)) print ''; - dol_fiche_head(''); + dol_fiche_head(''); - print '
'.$langs->trans("Source").''.$langs->trans("Nature").''.$langs->trans("ThirdParty").''.$langs->trans("TaskContact").''.$langs->trans("Users").''.$langs->trans("ContactType").' 
'; + print '
'; - $defaultref=''; - $obj = empty($conf->global->PROJECT_TASK_ADDON)?'mod_task_simple':$conf->global->PROJECT_TASK_ADDON; - if (! empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) - { - require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; - $modTask = new $obj; - $defaultref = $modTask->getNextValue($object->thirdparty,null); - } + $defaultref=''; + $obj = empty($conf->global->PROJECT_TASK_ADDON)?'mod_task_simple':$conf->global->PROJECT_TASK_ADDON; + if (! empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) + { + require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; + $modTask = new $obj; + $defaultref = $modTask->getNextValue($object->thirdparty,null); + } - if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; + if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; - // Ref - print ''; + // Ref + print ''; - print ''; + print ''; - // List of projects - print ''; + // List of projects + print ''; - print ''; - - // Date start - print ''; - - // Date end - print ''; - - // Planned workload - print ''; - - // Progress - print ''; - - // Description - print ''; - print ''; - - // Other options - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$taskstatic,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - if (empty($reshook) && ! empty($extrafields_task->attribute_label)) - { - print $taskstatic->showOptionals($extrafields_task,'edit'); // Do not use $object here that is object of project - } + print ''; + + // Date start + print ''; + + // Date end + print ''; + + // Planned workload + print ''; + + // Progress + print ''; + + // Description + print ''; + print ''; + + // Other options + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$taskstatic,$action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + if (empty($reshook) && ! empty($extrafields_task->attribute_label)) + { + print $taskstatic->showOptionals($extrafields_task,'edit'); // Do not use $object here that is object of project + } - print '
'.$langs->trans("Ref").''; - if (empty($duplicate_code_error)) - { - print (GETPOSTISSET("ref")?GETPOST("ref",'alpha'):$defaultref); - } - else - { - print $defaultref; - } - print ''; - print '
'.$langs->trans("Ref").''; + if (empty($duplicate_code_error)) + { + print (GETPOSTISSET("ref")?GETPOST("ref",'alpha'):$defaultref); + } + else + { + print $defaultref; + } + print ''; + print '
'.$langs->trans("Label").''; - print ''; - print '
'.$langs->trans("Label").''; + print ''; + print '
'.$langs->trans("ChildOfProjectTask").''; - print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500'); - print '
'.$langs->trans("ChildOfProjectTask").''; + print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500'); + print '
'.$langs->trans("AffectedTo").''; - $contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):''); - if (is_array($contactsofproject) && count($contactsofproject)) - { - print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); - } - else - { - print $langs->trans("NoUserAssignedToTheProject"); - } - print '
'.$langs->trans("DateStart").''; - print $form->selectDate(($date_start?$date_start:''), 'dateo', 1, 1, 0, '', 1, 1); - print '
'.$langs->trans("DateEnd").''; - print $form->selectDate(($date_end?$date_end:-1),'datee', -1, 1, 0, '', 1, 1); - print '
'.$langs->trans("PlannedWorkload").''; - print $form->select_duration('planned_workload', $planned_workload?$planned_workload : 0, 0, 'text'); - print '
'.$langs->trans("ProgressDeclared").''; - print $formother->select_percent($progress,'progress',0,5,0,100,1); - print '
'.$langs->trans("Description").''; - print ''; - print '
'.$langs->trans("AffectedTo").''; + $contactsofproject=(! empty($object->id)?$object->getListContactId('internal'):''); + if (is_array($contactsofproject) && count($contactsofproject)) + { + print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); + } + else + { + print $langs->trans("NoUserAssignedToTheProject"); + } + print '
'.$langs->trans("DateStart").''; + print $form->selectDate(($date_start?$date_start:''), 'dateo', 1, 1, 0, '', 1, 1); + print '
'.$langs->trans("DateEnd").''; + print $form->selectDate(($date_end?$date_end:-1),'datee', -1, 1, 0, '', 1, 1); + print '
'.$langs->trans("PlannedWorkload").''; + print $form->select_duration('planned_workload', $planned_workload?$planned_workload : 0, 0, 'text'); + print '
'.$langs->trans("ProgressDeclared").''; + print $formother->select_percent($progress,'progress',0,5,0,100,1); + print '
'.$langs->trans("Description").''; + print ''; + print '
'; + print ''; - dol_fiche_end(); + dol_fiche_end(); - print '
'; - print ''; - print '     '; - print ''; - print '
'; + print '
'; + print ''; + print '     '; + print ''; + print '
'; - print ''; + print ''; + } } else if ($id > 0 || ! empty($ref)) { From b35a9c0e64a7be63b4f96dadf9084002685ea96a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 17:50:58 +0100 Subject: [PATCH 09/14] FIX Edition of menu fails (mainmenu required for top menu) --- htdocs/admin/menus/edit.php | 66 +++++++++++++++++------- htdocs/core/class/menubase.class.php | 1 - htdocs/core/menus/standard/eldy.lib.php | 7 ++- htdocs/core/menus/standard/eldy_menu.php | 7 ++- htdocs/langs/en_US/admin.lang | 1 + htdocs/main.inc.php | 16 +++--- 6 files changed, 66 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 4d5cc2be274f8..21a085257b88e 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -96,6 +96,7 @@ $menu->perms=GETPOST('perms','alpha'); $menu->target=GETPOST('target','alpha'); $menu->user=GETPOST('user','alpha'); + $menu->mainmenu=GETPOST('propertymainmenu','alpha'); if (is_numeric(GETPOST('menuIdParent','alpha'))) { $menu->fk_menu=GETPOST('menuIdParent','alpha'); @@ -123,14 +124,11 @@ setEventMessages($menu->error, $menu->errors, 'errors'); } $action = "edit"; - } - else - { + header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); exit; } - - if ($_GET['return']) + else { header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); exit; @@ -215,6 +213,7 @@ $menu->perms=GETPOST('perms','alpha'); $menu->target=GETPOST('target','alpha'); $menu->user=GETPOST('user','alpha'); + $menu->mainmenu=GETPOST('propertymainmenu','alpha'); if (is_numeric(GETPOST('menuId','int'))) { $menu->fk_menu=GETPOST('menuId','int'); @@ -338,7 +337,7 @@ function init_topleft() print ''; print ''.$langs->trans('DetailMenuHandler').''; - //User + // User print ''.$langs->trans('MenuForUsers').''; print ''; } - // print ''; print ''.$langs->trans('DetailType').''; + // Mainmenu code + print ''.$langs->trans('MainMenuCode').''; + /*if ($parent_rowid) + { + print ''.$parent_rowid.''; + } + else + {*/ + print ''; + //} + print ''; + print $langs->trans("Example").': mytopmenukey'; + print ''; + // MenuId Parent print ''.$langs->trans('MenuIdParent').''; if ($parent_rowid) @@ -373,23 +385,23 @@ function init_topleft() } else { - print ''; + print ''; } print ''.$langs->trans('DetailMenuIdParent'); print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print ''; // Title - print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; + print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; // URL - print ''.$langs->trans('URL').''.$langs->trans('DetailUrl').''; + print ''.$langs->trans('URL').''.$langs->trans('DetailUrl').''; // Langs - print ''.$langs->trans('LangFile').''.$langs->trans('DetailLangs').''; + print ''.$langs->trans('LangFile').''.$langs->trans('DetailLangs').''; // Position - print ''.$langs->trans('Position').''.$langs->trans('DetailPosition').''; + print ''.$langs->trans('Position').''.$langs->trans('DetailPosition').''; // Target print ''.$langs->trans('Target').''.$langs->trans('DetailTarget').''; // Enabled - print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').''; + print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').''; // Perms - print ''.$langs->trans('Rights').''.$langs->trans('DetailRight').''; + print ''.$langs->trans('Rights').''.$langs->trans('DetailRight').''; print ''; @@ -455,13 +467,27 @@ function init_topleft() // Type print ''.$langs->trans('Type').''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').''; + // Mainmenu code + print ''.$langs->trans('MainMenuCode').''; + /*if ($parent_rowid) + { + print ''.$parent_rowid.''; + } + else + {*/ + print 'mainmenu).'">'; + //} + print ''; + print $langs->trans("Example").': mytopmenukey'; + print ''; + // MenuId Parent print ''.$langs->trans('MenuIdParent'); print ''; $valtouse=$menu->fk_menu; if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; - print ''; + print ''; print ''.$langs->trans('DetailMenuIdParent'); print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print ''; @@ -470,16 +496,16 @@ function init_topleft() //print ''.$langs->trans('Level').''.$menu->level.''.$langs->trans('DetailLevel').''; // Title - print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; + print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; // Url print ''.$langs->trans('URL').''.$langs->trans('DetailUrl').''; // Langs - print ''.$langs->trans('LangFile').''.$langs->trans('DetailLangs').''; + print ''.$langs->trans('LangFile').''.$langs->trans('DetailLangs').''; // Position - print ''.$langs->trans('Position').''.$langs->trans('DetailPosition').''; + print ''.$langs->trans('Position').''.$langs->trans('DetailPosition').''; // Target print ''.$langs->trans('Target').''.$langs->trans('DetailTarget').''; // Enabled - print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled'); + print ''.$langs->trans('Enabled').''.$langs->trans('DetailEnabled'); if (! empty($menu->enabled)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->enabled,1)).')'; print ''; // Perms - print ''.$langs->trans('Rights').''.$langs->trans('DetailRight'); + print ''.$langs->trans('Rights').''.$langs->trans('DetailRight'); if (! empty($menu->perms)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->perms,1)).')'; print ''; diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 7f4ab7c6d4a72..86b279483895a 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -589,7 +589,6 @@ function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu $a = 0; $b = 0; - $oldrowid=0; while ($a < $numa) { //$objm = $this->db->fetch_object($resql); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2bf4671504f7b..ce2145d39864e 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -468,6 +468,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; + //var_dump($tabMenu); + $newmenu = $menu; $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]); @@ -523,7 +525,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu * We update newmenu with entries found into database * -------------------------------------------------- */ - if ($mainmenu) + if ($mainmenu) // If this is empty, loading hard coded menu and loading personalised menu will fail { /* * Menu HOME @@ -1628,6 +1630,9 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } + //var_dump($tabMenu); // + //var_dump($newmenu->liste); + // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after //var_dump($menu_array_before);exit; //var_dump($menu_array_after);exit; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 049956e82e260..4992fc6d11c21 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -31,7 +31,7 @@ class MenuManager * @var DoliDB Database handler. */ public $db; - + var $type_user; // Put 0 for internal users, 1 for external users var $atarget=""; // To store default target to use onto links var $name="eldy"; @@ -109,6 +109,7 @@ function loadMenu($forcemainmenu='',$forceleftmenu='') $menuArbo = new Menubase($this->db,'eldy'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu); $this->tabMenu=$tabMenu; + //var_dump($tabMenu); //if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; } } @@ -116,7 +117,7 @@ function loadMenu($forcemainmenu='',$forceleftmenu='') /** * Show menu. - * Module defined in sql tables are stored into this->tabMenu BEFORE this is called. + * Module defined in sql tables were stored into $this->tabMenu BEFORE this is called. * * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output @@ -126,6 +127,8 @@ function showmenu($mode, $moredata=null) { global $conf, $langs, $user; + //var_dump($this->tabMenu); + require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php'; if ($this->type_user == 1) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8d6e8e39b0476..d580fa908097a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1844,6 +1844,7 @@ LoadThirdPartyFromNameOrCreate=Load thirdparty from name (create if not found) WithDolTrackingID=Dolibarr Tracking ID found WithoutDolTrackingID=Dolibarr Tracking ID not found FormatZip=Zip +MainMenuCode=Menu entry code (mainmenu) ##### Resource #### ResourceSetup=Configuration du module Resource UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list). diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 438fff1eb15e0..0f2f8af452e56 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -510,7 +510,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $error++; } // End Call of triggers - + // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -626,13 +626,13 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login); - + $user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; - + $user->trigger_mesg=$user->error; } @@ -644,7 +644,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $error++; } // End call triggers - + // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -689,7 +689,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; - + $user->trigger_mesg=$user->error; } @@ -701,7 +701,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $error++; } // End call triggers - + // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -799,7 +799,7 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $error++; } // End call triggers - + // Hooks on successfull login $action=''; $hookmanager->initHooks(array('login')); @@ -1074,7 +1074,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, if (empty($conf->dol_hide_leftmenu)) { - left_menu('', $help_url, '', '', 1, $title, 1); + left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function } // main area From 6105bb2bb62d0129fd4975cfa84ac03ea36812d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 18:10:57 +0100 Subject: [PATCH 10/14] Fix: difference between text and url into external web site module --- htdocs/externalsite/frames.php | 47 +++++++++++++++++++++++++++++++--- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index 611e84fe9c3ad..714b7b3e03742 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -22,7 +22,8 @@ * \brief Page that build two frames: One for menu, the other for the target page to show * Usage: * mydomain.com/externalsite/frames.php to show URL set into setup - * mydomain.com/externalsite/frames.php?keyforcontent to show content defined into conf->global->$keyforcontent + * mydomain.com/externalsite/frames.php?keyforcontent=EXTERNAL_SITE_CONTENT_abc to show html text defined into $conf->global->EXTERNAL_SITE_CONTENT_abc + * mydomain.com/externalsite/frames.php?keyforcontent=EXTERNAL_SITE_URL_abc to show URL defined into $conf->global->EXTERNAL_SITE_URL_abc */ require '../main.inc.php'; @@ -56,10 +57,11 @@ print '
'; - if (! preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) + if (! preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent) + && ! preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) { $langs->load("errors"); - print $langs->trans("Variablekeyforcontentmustbenamed", 'EXTERNAL_SITE_CONTENT_'); + print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent); } else if (empty($conf->global->$keyforcontent)) { @@ -68,7 +70,44 @@ } else { - print $conf->global->$keyforcontent; + if (preg_match('/EXTERNAL_SITE_CONTENT_/', $keyforcontent)) + { + print $conf->global->$keyforcontent; + } + elseif (preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) + { + print " + + + Dolibarr frame for external web site + + + global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0> + + "; + print ''; + print " + + <body> + + </body> + + + + + <body> + <br><div class=\"center\"> + Sorry, your browser is too old or not correctly configured to view this area.<br> + Your browser must support frames.<br> + </div> + </body> + + + + "; + } } print '
'; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4bb9fcf2dec33..79da7ef45f8aa 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -213,6 +213,7 @@ ErrorNoteAlsoThatSubProductCantBeFollowedByLot=Note also that using virtual prod ErrorDescRequiredForFreeProductLines=Description is mandatory for lines with free product ErrorAPageWithThisNameOrAliasAlreadyExists=The page/container %s has the same name or alternative alias that the one your try to use ErrorDuringChartLoad=Error when loading chart of account. If few accounts were not loaded, you can still enter them manually. +ErrorVariableKeyForContentMustBeSet=Error, the constant with name %s (with text content to show) or %s (with external url to show) must be set. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined From bdb42953793c6356b51e0c6bb099ed925fe9f52b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 18:24:05 +0100 Subject: [PATCH 11/14] Fix menu editor --- htdocs/admin/menus/edit.php | 41 +++++++++++++++++----------------- htdocs/externalsite/frames.php | 6 ++--- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 21a085257b88e..b16e9047b26a6 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -288,10 +288,13 @@ function init_topleft() { jQuery("#menuId").prop("disabled", true); jQuery("#menuId").val(\'\'); + jQuery("#propertymainmenu").removeAttr("disabled"); + jQuery("#propertymainmenu").val(\'\'); } - else + if (jQuery("#topleft").val() == \'left\') { jQuery("#menuId").removeAttr("disabled"); + jQuery("#propertymainmenu").prop("disabled", true); } } init_topleft(); @@ -365,14 +368,7 @@ function init_topleft() // Mainmenu code print ''.$langs->trans('MainMenuCode').''; - /*if ($parent_rowid) - { - print ''.$parent_rowid.''; - } - else - {*/ - print ''; - //} + print ''; print ''; print $langs->trans("Example").': mytopmenukey'; print ''; @@ -468,18 +464,21 @@ function init_topleft() print ''.$langs->trans('Type').''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').''; // Mainmenu code - print ''.$langs->trans('MainMenuCode').''; - /*if ($parent_rowid) - { - print ''.$parent_rowid.''; - } - else - {*/ - print 'mainmenu).'">'; - //} - print ''; - print $langs->trans("Example").': mytopmenukey'; - print ''; + if ($menu->type == 'top') + { + print ''.$langs->trans('MainMenuCode').''; + /*if ($parent_rowid) + { + print ''.$parent_rowid.''; + } + else + {*/ + print 'mainmenu).'">'; + //} + print ''; + print $langs->trans("Example").': mytopmenukey'; + print ''; + } // MenuId Parent print ''.$langs->trans('MenuIdParent'); diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index 714b7b3e03742..26e6e65b7a41a 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -21,9 +21,9 @@ * \ingroup externalsite * \brief Page that build two frames: One for menu, the other for the target page to show * Usage: - * mydomain.com/externalsite/frames.php to show URL set into setup - * mydomain.com/externalsite/frames.php?keyforcontent=EXTERNAL_SITE_CONTENT_abc to show html text defined into $conf->global->EXTERNAL_SITE_CONTENT_abc - * mydomain.com/externalsite/frames.php?keyforcontent=EXTERNAL_SITE_URL_abc to show URL defined into $conf->global->EXTERNAL_SITE_URL_abc + * /externalsite/frames.php to show URL set into setup + * /externalsite/frames.php?keyforcontent=EXTERNAL_SITE_CONTENT_abc to show html text defined into $conf->global->EXTERNAL_SITE_CONTENT_abc + * /externalsite/frames.php?keyforcontent=EXTERNAL_SITE_URL_abc to show URL defined into $conf->global->EXTERNAL_SITE_URL_abc */ require '../main.inc.php'; From e2a575e54799d2f8da872a8e8f8b725b8ae099b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 18:44:45 +0100 Subject: [PATCH 12/14] Fix use of external url in iframes --- htdocs/externalsite/frames.php | 4 ++-- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index 26e6e65b7a41a..ab26b74b3b2fe 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -61,12 +61,12 @@ && ! preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) { $langs->load("errors"); - print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent); + print $langs->trans("ErrorBadSyntaxForParamKeyForContent", 'EXTERNAL_SITE_CONTENT_', 'EXTERNAL_SITE_URL_'); } else if (empty($conf->global->$keyforcontent)) { $langs->load("errors"); - print $langs->trans("ErrorNoContentDefinedIntoVar", $keyforcontent); + print $langs->trans("ErrorVariableKeyForContentMustBeSet", 'EXTERNAL_SITE_CONTENT_'.$keyforcontent, 'EXTERNAL_SITE_URL_'.$keyforcontent); } else { diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 79da7ef45f8aa..cb183d12ce299 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -213,6 +213,7 @@ ErrorNoteAlsoThatSubProductCantBeFollowedByLot=Note also that using virtual prod ErrorDescRequiredForFreeProductLines=Description is mandatory for lines with free product ErrorAPageWithThisNameOrAliasAlreadyExists=The page/container %s has the same name or alternative alias that the one your try to use ErrorDuringChartLoad=Error when loading chart of account. If few accounts were not loaded, you can still enter them manually. +ErrorBadSyntaxForParamKeyForContent=Bad syntax for param keyforcontent. Must have a value starting with %s or %s ErrorVariableKeyForContentMustBeSet=Error, the constant with name %s (with text content to show) or %s (with external url to show) must be set. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From 3c8aa38bf7e71b4b4f0091035977832748c6553b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Dec 2018 19:06:34 +0100 Subject: [PATCH 13/14] Fix use iframe to embed content --- htdocs/externalsite/frames.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/externalsite/frames.php b/htdocs/externalsite/frames.php index ab26b74b3b2fe..c7f9214238192 100644 --- a/htdocs/externalsite/frames.php +++ b/htdocs/externalsite/frames.php @@ -76,7 +76,7 @@ } elseif (preg_match('/EXTERNAL_SITE_URL_/', $keyforcontent)) { - print " + /*print " Dolibarr frame for external web site @@ -106,7 +106,8 @@ - "; + ";*/ + print ''; } } From a107d16338d3d5c2d0710832d037eb26952563ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Dec 2018 09:52:00 +0100 Subject: [PATCH 14/14] Revert "clean and update code" This reverts commit 68de0ba93b0a0efc86640c7d08540b7dfe7bd014. --- htdocs/comm/mailing/cibles.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 57d6adc1ba970..cc920e3d12411 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -329,14 +329,16 @@ // Si le module mailing est qualifie if ($qualified) { + $var = ! $var; + if ($allowaddtarget) { - print '
'; + print ''; print ''; } else { - print '
'; + print '
'; } print '
';