NEW Can set the page "List of opportunities" as landing page
This commit is contained in:
parent
0fb03fdc2d
commit
1bab847278
@ -152,7 +152,7 @@ class box_funnel_of_prospection extends ModeleBoxes
|
||||
'graph' => '1'
|
||||
);
|
||||
|
||||
if ($user->rights->projet->lire || !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
|
||||
if ($user->hasRight('projet', 'lire') || getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
|
||||
$sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||
|
||||
@ -8112,26 +8112,26 @@ class Form
|
||||
|
||||
|
||||
/**
|
||||
* Return a HTML select string, built from an array of key+value.
|
||||
* Return a HTML select string, built from an array of key+value.
|
||||
* Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
|
||||
*
|
||||
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
||||
* @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...))
|
||||
* @param string|string[] $id Preselected key or preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record.
|
||||
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value.
|
||||
* @param int $key_in_label 1 to show key into label with format "[key] value"
|
||||
* @param int $value_as_key 1 to use value as key
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param int $translate 1=Translate and encode value
|
||||
* @param int $maxlen Length maximum for labels
|
||||
* @param int $disabled Html select box is disabled
|
||||
* @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order
|
||||
* @param string $morecss Add more class to css styles
|
||||
* @param int $addjscombo Add js combo
|
||||
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set
|
||||
* @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry
|
||||
* @param int $nohtmlescape No html escaping.
|
||||
* @return string HTML select string.
|
||||
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
||||
* @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...))
|
||||
* @param string|string[] $id Preselected key or preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record.
|
||||
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value.
|
||||
* @param int $key_in_label 1 to show key into label with format "[key] value"
|
||||
* @param int $value_as_key 1 to use value as key
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param int $translate 1=Translate and encode value
|
||||
* @param int $maxlen Length maximum for labels
|
||||
* @param int $disabled Html select box is disabled
|
||||
* @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order
|
||||
* @param string $morecss Add more class to css styles
|
||||
* @param int $addjscombo Add js combo
|
||||
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set
|
||||
* @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry
|
||||
* @param int $nohtmlescape No html escaping.
|
||||
* @return string HTML select string.
|
||||
* @see multiselectarray(), selectArrayAjax(), selectArrayFilter()
|
||||
*/
|
||||
public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = 'minwidth75', $addjscombo = 1, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)
|
||||
@ -8245,7 +8245,7 @@ class Form
|
||||
if (is_array($tmpvalue)) {
|
||||
foreach ($tmpvalue as $keyforvalue => $valueforvalue) {
|
||||
if (preg_match('/^data-/', $keyforvalue)) {
|
||||
$out .= ' ' . $keyforvalue . '="' . $valueforvalue . '"';
|
||||
$out .= ' '.$keyforvalue.'="'.dol_escape_htmltag($valueforvalue).'"';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,9 +176,11 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
|
||||
$title = $person_name." - ".$langs->trans('Card');
|
||||
$help_url = '';
|
||||
@ -186,33 +188,37 @@ $help_url = '';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
// List of possible landing pages
|
||||
$tmparray = array('index.php'=>'Dashboard');
|
||||
$tmparray = array();
|
||||
$tmparray['index.php'] = array('label'=>'Dashboard', 'picto'=>'graph');
|
||||
if (isModEnabled("societe")) {
|
||||
$tmparray['societe/index.php?mainmenu=companies&leftmenu='] = 'ThirdPartiesArea';
|
||||
$tmparray['societe/index.php?mainmenu=companies&leftmenu='] = array('label'=>'ThirdPartiesArea', 'picto'=>'company');
|
||||
}
|
||||
if (!empty($conf->project->enabled)) {
|
||||
$tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea';
|
||||
$tmparray['projet/index.php?mainmenu=project&leftmenu='] = array('label'=>'ProjectsArea', 'picto'=>'project');
|
||||
if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
|
||||
$tmparray['projet/list.php?mainmenu=project&leftmenu=&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead'] = array('label'=>'ListOpenLeads', 'picto'=>'project');
|
||||
}
|
||||
}
|
||||
if (isModEnabled('holiday') || isModEnabled('expensereport')) {
|
||||
$tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea'; // TODO Complete list with first level of menus
|
||||
$tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = array('label'=>'HRMArea', 'picto'=>'user'); // TODO Complete list with first level of menus
|
||||
}
|
||||
if (isModEnabled("product") || isModEnabled("service")) {
|
||||
$tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea';
|
||||
$tmparray['product/index.php?mainmenu=products&leftmenu='] = array('label'=>'ProductsAndServicesArea', 'picto'=>'product');
|
||||
}
|
||||
if (isModEnabled("propal") || isModEnabled('commande') || isModEnabled('ficheinter') || isModEnabled('contrat')) {
|
||||
$tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea';
|
||||
$tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = array('label'=>'CommercialArea', 'picto'=>'commercial');
|
||||
}
|
||||
if (isModEnabled('comptabilite') || isModEnabled('accounting')) {
|
||||
$tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea';
|
||||
$tmparray['compta/index.php?mainmenu=compta&leftmenu='] = array('label'=>'AccountancyTreasuryArea', 'picto'=>'bill');
|
||||
}
|
||||
if (isModEnabled('adherent')) {
|
||||
$tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea';
|
||||
$tmparray['adherents/index.php?mainmenu=members&leftmenu='] = array('label'=>'MembersArea', 'picto'=>'member');
|
||||
}
|
||||
if (isModEnabled('agenda')) {
|
||||
$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
|
||||
$tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = array('label'=>'Agenda', 'picto'=>'action');
|
||||
}
|
||||
if (isModEnabled('ticket')) {
|
||||
$tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets';
|
||||
$tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = array('label'=>'Tickets', 'picto'=>'ticket');
|
||||
}
|
||||
// add bookmarks to available landing pages
|
||||
if (empty($conf->global->MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES)) {
|
||||
@ -227,11 +233,15 @@ if (empty($conf->global->MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES)) {
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$landing_url = str_replace(DOL_URL_ROOT, '', $obj->url);
|
||||
$tmparray[$landing_url] = $obj->title;
|
||||
$i++;
|
||||
if ($num_rows > 0) {
|
||||
$tmparray['sep'.$i] = '<span class="opacitymedium">--- '.$langs->trans("Bookmarks").'</span>';
|
||||
while ($i < $num_rows) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$landing_url = str_replace(DOL_URL_ROOT, '', $obj->url);
|
||||
$tmparray[$landing_url] = array('label'=>$obj->title, 'picto'=>'generic');
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,9 +251,13 @@ $reshook = $hookmanager->executeHooks('addToLandingPageList', $tmparray, $object
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
} elseif ($reshook > 0) {
|
||||
$tmparray=$hookmanager->resArray;
|
||||
$tmparray = $hookmanager->resArray;
|
||||
} elseif ($reshook == 0) {
|
||||
$tmparray=array_merge($tmparray, $hookmanager->resArray);
|
||||
$tmparray = array_merge($tmparray, $hookmanager->resArray);
|
||||
}
|
||||
foreach ($tmparray as $key => $val) {
|
||||
$tmparray[$key]['data-html'] = img_picto($langs->trans($val['label']), $val['picto'], 'class="pictofixedwidth"').$langs->trans($val['label']);
|
||||
$tmparray[$key]['label'] = $langs->trans($val['label']);
|
||||
}
|
||||
|
||||
$head = user_prepare_head($object);
|
||||
@ -338,7 +352,7 @@ if ($action == 'edit') {
|
||||
print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
|
||||
print '> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans("UsePersonalValue").'</label></td>';
|
||||
print '<td>';
|
||||
print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 1);
|
||||
print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250');
|
||||
//print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -444,13 +458,22 @@ if ($action == 'edit') {
|
||||
print '> '.$langs->trans("UsePersonalValue").'</td>';
|
||||
print '<td>';
|
||||
if (!empty($object->conf->MAIN_LANDING_PAGE)) {
|
||||
$urltoshow = '';
|
||||
if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
|
||||
print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
|
||||
if (is_array($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
|
||||
$urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]['label']);
|
||||
} else {
|
||||
$urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
|
||||
}
|
||||
} else {
|
||||
print $object->conf->MAIN_LANDING_PAGE;
|
||||
$urltoshow = $object->conf->MAIN_LANDING_PAGE;
|
||||
}
|
||||
print ' <a href="'.DOL_URL_ROOT.'/'.$object->conf->MAIN_LANDING_PAGE.'" target="_blank" rel="noopener">';
|
||||
print img_picto($urltoshow, $tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'], 'class="pictofixedwidth"');
|
||||
print $urltoshow;
|
||||
print img_picto($urltoshow, 'globe', 'class="paddingleft"');
|
||||
print '</a>';
|
||||
}
|
||||
//print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Landing page for Agenda - AGENDA_DEFAULT_VIEW
|
||||
|
||||
Loading…
Reference in New Issue
Block a user