Merge branch 'Dolibarr:develop' into SELECT_PRODUITS_LIST
This commit is contained in:
commit
b299068cf6
@ -106,6 +106,9 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
if (isset($_SERVER['HTTP_DOLAPIKEY'])) { // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
if (isset($_SERVER['HTTP_DOLAPIKEY'])) { // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
||||||
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
||||||
}
|
}
|
||||||
|
if (preg_match('/^dolcrypt:/i', $api_key)) {
|
||||||
|
throw new RestException(503, 'Bad value for the API key. An API key should not start with dolcrypt:');
|
||||||
|
}
|
||||||
|
|
||||||
if ($api_key) {
|
if ($api_key) {
|
||||||
$userentity = 0;
|
$userentity = 0;
|
||||||
|
|||||||
@ -1304,7 +1304,8 @@ if (empty($reshook)) {
|
|||||||
$object->date_pointoftax = $date_pointoftax;
|
$object->date_pointoftax = $date_pointoftax;
|
||||||
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
$object->note_public = trim(GETPOST('note_public', 'restricthtml'));
|
||||||
$object->note_private = trim(GETPOST('note_private', 'restricthtml'));
|
$object->note_private = trim(GETPOST('note_private', 'restricthtml'));
|
||||||
$object->ref_client = GETPOST('ref_client');
|
$object->ref_customer = GETPOST('ref_client');
|
||||||
|
$object->ref_client = $object->ref_customer;
|
||||||
$object->model_pdf = GETPOST('model');
|
$object->model_pdf = GETPOST('model');
|
||||||
$object->fk_project = GETPOST('projectid', 'int');
|
$object->fk_project = GETPOST('projectid', 'int');
|
||||||
$object->cond_reglement_id = (GETPOST('type') == 3 ? 1 : GETPOST('cond_reglement_id'));
|
$object->cond_reglement_id = (GETPOST('type') == 3 ? 1 : GETPOST('cond_reglement_id'));
|
||||||
|
|||||||
@ -261,7 +261,12 @@ if ($object->id > 0) {
|
|||||||
$param .= '&limit='.$limit;
|
$param .= '&limit='.$limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("ActionsOnContract"), $newcardbutton, '');
|
// Try to know count of actioncomm from cache
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||||
|
$cachekey = 'count_events_thirdparty_'.$object->id;
|
||||||
|
$nbEvent = dol_getcache($cachekey);
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans("ActionsOnContract").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), $newcardbutton, '');
|
||||||
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
|
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
|
||||||
|
|
||||||
// List of all actions
|
// List of all actions
|
||||||
|
|||||||
@ -98,10 +98,15 @@ class FormMargin
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pv = $line->total_ht;
|
$pv = $line->total_ht;
|
||||||
$pa_ht = ($pv < 0 ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
|
$pa_ht = (($pv < 0 || ($pv == 0 && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
|
||||||
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
|
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode
|
||||||
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
|
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
|
||||||
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);
|
|| ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
|
||||||
|
// We need a compensation relative to $line->situation_percent
|
||||||
|
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);
|
||||||
|
} else {
|
||||||
|
$pa = $line->qty * $pa_ht;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$pa = $line->qty * $pa_ht;
|
$pa = $line->qty * $pa_ht;
|
||||||
}
|
}
|
||||||
@ -213,7 +218,7 @@ class FormMargin
|
|||||||
|
|
||||||
$marginInfo = $this->getMarginInfosArray($object, $force_price);
|
$marginInfo = $this->getMarginInfosArray($object, $force_price);
|
||||||
|
|
||||||
$parameters=array('marginInfo'=>&$marginInfo);
|
$parameters=array('marginInfo' => &$marginInfo);
|
||||||
$reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action);
|
$reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action);
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
@ -233,8 +238,8 @@ class FormMargin
|
|||||||
print '});</script>';
|
print '});</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<!-- displayMarginInfos() - Show margin table -->' . "\n";
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<!-- Margin table -->' . "\n";
|
|
||||||
|
|
||||||
print '<table class="noborder margintable centpercent" id="margintable">';
|
print '<table class="noborder margintable centpercent" id="margintable">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|||||||
@ -87,11 +87,37 @@ function contract_prepare_head(Contrat $object)
|
|||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Events");
|
$head[$h][1] = $langs->trans("Events");
|
||||||
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||||
|
$nbEvent = 0;
|
||||||
|
// Enable caching of thirdparty count actioncomm
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||||
|
$cachekey = 'count_events_contract_'.$object->id;
|
||||||
|
$dataretrieved = dol_getcache($cachekey);
|
||||||
|
if (!is_null($dataretrieved)) {
|
||||||
|
$nbEvent = $dataretrieved;
|
||||||
|
} else {
|
||||||
|
$sql = "SELECT COUNT(id) as nb";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
|
||||||
|
$sql .= " WHERE fk_element = ".((int) $object->id);
|
||||||
|
$sql .= " AND elementtype = 'contract'";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nbEvent = $obj->nb;
|
||||||
|
} else {
|
||||||
|
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
|
||||||
|
}
|
||||||
|
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||||
|
}
|
||||||
|
|
||||||
$head[$h][1] .= '/';
|
$head[$h][1] .= '/';
|
||||||
$head[$h][1] .= $langs->trans("Agenda");
|
$head[$h][1] .= $langs->trans("Agenda");
|
||||||
|
if ($nbEvent > 0) {
|
||||||
|
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$head[$h][2] = 'agenda';
|
$head[$h][2] = 'agenda';
|
||||||
$h++;
|
$h++;
|
||||||
|
|||||||
@ -5413,7 +5413,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict
|
|||||||
* @param string $morecss More css to the table
|
* @param string $morecss More css to the table
|
||||||
* @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
|
* @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
|
||||||
* @param int $hideselectlimit Force to hide select limit
|
* @param int $hideselectlimit Force to hide select limit
|
||||||
* @param int $hidenavigation Force to hide all navigation tools
|
* @param int $hidenavigation Force to hide the arrows and page for navigation
|
||||||
* @param int $pagenavastextinput 1=Do not suggest list of pages to navigate but suggest the page number into an input field.
|
* @param int $pagenavastextinput 1=Do not suggest list of pages to navigate but suggest the page number into an input field.
|
||||||
* @param string $morehtmlrightbeforearrow More html to show (before arrows)
|
* @param string $morehtmlrightbeforearrow More html to show (before arrows)
|
||||||
* @return void
|
* @return void
|
||||||
@ -5536,8 +5536,8 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($savlimit || $morehtmlright || $morehtmlrightbeforearrow) && empty($hidenavigation)) {
|
if ($savlimit || $morehtmlright || $morehtmlrightbeforearrow) {
|
||||||
print_fleche_navigation((int) $page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow); // output the div and ul for previous/last completed with page numbers into $pagelist
|
print_fleche_navigation((int) $page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow, $hidenavigation); // output the div and ul for previous/last completed with page numbers into $pagelist
|
||||||
}
|
}
|
||||||
|
|
||||||
// js to autoselect page field on focus
|
// js to autoselect page field on focus
|
||||||
@ -5571,9 +5571,10 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
|
|||||||
* @param int $totalnboflines Total number of records/lines for all pages (if known)
|
* @param int $totalnboflines Total number of records/lines for all pages (if known)
|
||||||
* @param int $hideselectlimit Force to hide select limit
|
* @param int $hideselectlimit Force to hide select limit
|
||||||
* @param string $beforearrows HTML content to show before arrows. Must NOT contains '<li> </li>' tags.
|
* @param string $beforearrows HTML content to show before arrows. Must NOT contains '<li> </li>' tags.
|
||||||
|
* @param int $hidenavigation Force to hide the arrows and page for navigation
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $betweenarrows = '', $afterarrows = '', $limit = -1, $totalnboflines = 0, $hideselectlimit = 0, $beforearrows = '')
|
function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $betweenarrows = '', $afterarrows = '', $limit = -1, $totalnboflines = 0, $hideselectlimit = 0, $beforearrows = '', $hidenavigation = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -5583,69 +5584,71 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
|||||||
print $beforearrows;
|
print $beforearrows;
|
||||||
print '</li>';
|
print '</li>';
|
||||||
}
|
}
|
||||||
if ((int) $limit > 0 && empty($hideselectlimit)) {
|
if (!empty($hidenavigation)) {
|
||||||
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000';
|
if ((int) $limit > 0 && empty($hideselectlimit)) {
|
||||||
$pagesizechoices .= ',5000:5000,10000:10000,20000:20000';
|
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000';
|
||||||
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
|
$pagesizechoices .= ',5000:5000,10000:10000,20000:20000';
|
||||||
//$pagesizechoices.=',2:2';
|
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
|
||||||
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) {
|
//$pagesizechoices.=',2:2';
|
||||||
$pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;
|
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) {
|
||||||
}
|
$pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;
|
||||||
|
|
||||||
print '<li class="pagination">';
|
|
||||||
print '<select class="flat selectlimit" name="limit" title="'.dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")).'">';
|
|
||||||
$tmpchoice = explode(',', $pagesizechoices);
|
|
||||||
$tmpkey = $limit.':'.$limit;
|
|
||||||
if (!in_array($tmpkey, $tmpchoice)) {
|
|
||||||
$tmpchoice[] = $tmpkey;
|
|
||||||
}
|
|
||||||
$tmpkey = $conf->liste_limit.':'.$conf->liste_limit;
|
|
||||||
if (!in_array($tmpkey, $tmpchoice)) {
|
|
||||||
$tmpchoice[] = $tmpkey;
|
|
||||||
}
|
|
||||||
asort($tmpchoice, SORT_NUMERIC);
|
|
||||||
foreach ($tmpchoice as $val) {
|
|
||||||
$selected = '';
|
|
||||||
$tmp = explode(':', $val);
|
|
||||||
$key = $tmp[0];
|
|
||||||
$val = $tmp[1];
|
|
||||||
if ($key != '' && $val != '') {
|
|
||||||
if ((int) $key == (int) $limit) {
|
|
||||||
$selected = ' selected="selected"';
|
|
||||||
}
|
|
||||||
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<li class="pagination">';
|
||||||
|
print '<select class="flat selectlimit" name="limit" title="'.dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")).'">';
|
||||||
|
$tmpchoice = explode(',', $pagesizechoices);
|
||||||
|
$tmpkey = $limit.':'.$limit;
|
||||||
|
if (!in_array($tmpkey, $tmpchoice)) {
|
||||||
|
$tmpchoice[] = $tmpkey;
|
||||||
|
}
|
||||||
|
$tmpkey = $conf->liste_limit.':'.$conf->liste_limit;
|
||||||
|
if (!in_array($tmpkey, $tmpchoice)) {
|
||||||
|
$tmpchoice[] = $tmpkey;
|
||||||
|
}
|
||||||
|
asort($tmpchoice, SORT_NUMERIC);
|
||||||
|
foreach ($tmpchoice as $val) {
|
||||||
|
$selected = '';
|
||||||
|
$tmp = explode(':', $val);
|
||||||
|
$key = $tmp[0];
|
||||||
|
$val = $tmp[1];
|
||||||
|
if ($key != '' && $val != '') {
|
||||||
|
if ((int) $key == (int) $limit) {
|
||||||
|
$selected = ' selected="selected"';
|
||||||
|
}
|
||||||
|
print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</select>';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print '<!-- JS CODE TO ENABLE select limit to launch submit of page -->
|
||||||
|
<script>
|
||||||
|
jQuery(document).ready(function () {
|
||||||
|
jQuery(".selectlimit").change(function() {
|
||||||
|
console.log("Change limit. Send submit");
|
||||||
|
$(this).parents(\'form:first\').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
print '</li>';
|
||||||
}
|
}
|
||||||
print '</select>';
|
if ($page > 0) {
|
||||||
if ($conf->use_javascript_ajax) {
|
print '<li class="pagination paginationpage paginationpageleft"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>';
|
||||||
print '<!-- JS CODE TO ENABLE select limit to launch submit of page -->
|
}
|
||||||
<script>
|
if ($betweenarrows) {
|
||||||
jQuery(document).ready(function () {
|
print '<!--<div class="betweenarrows nowraponall inline-block">-->';
|
||||||
jQuery(".selectlimit").change(function() {
|
print $betweenarrows;
|
||||||
console.log("Change limit. Send submit");
|
print '<!--</div>-->';
|
||||||
$(this).parents(\'form:first\').submit();
|
}
|
||||||
});
|
if ($nextpage > 0) {
|
||||||
});
|
print '<li class="pagination paginationpage paginationpageright"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
|
||||||
</script>
|
}
|
||||||
';
|
if ($afterarrows) {
|
||||||
|
print '<li class="paginationafterarrows">';
|
||||||
|
print $afterarrows;
|
||||||
|
print '</li>';
|
||||||
}
|
}
|
||||||
print '</li>';
|
|
||||||
}
|
|
||||||
if ($page > 0) {
|
|
||||||
print '<li class="pagination paginationpage paginationpageleft"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>';
|
|
||||||
}
|
|
||||||
if ($betweenarrows) {
|
|
||||||
print '<!--<div class="betweenarrows nowraponall inline-block">-->';
|
|
||||||
print $betweenarrows;
|
|
||||||
print '<!--</div>-->';
|
|
||||||
}
|
|
||||||
if ($nextpage > 0) {
|
|
||||||
print '<li class="pagination paginationpage paginationpageright"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
|
|
||||||
}
|
|
||||||
if ($afterarrows) {
|
|
||||||
print '<li class="paginationafterarrows">';
|
|
||||||
print $afterarrows;
|
|
||||||
print '</li>';
|
|
||||||
}
|
}
|
||||||
print '</ul></div>'."\n";
|
print '</ul></div>'."\n";
|
||||||
}
|
}
|
||||||
@ -12310,25 +12313,28 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||||||
$out .= '</div>';
|
$out .= '</div>';
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
|
$libelle = '';
|
||||||
$out .= ' <div class="messaging-title inline-block">';
|
$out .= ' <div class="messaging-title inline-block">';
|
||||||
|
|
||||||
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
|
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
|
||||||
$out .= $langs->trans('TicketNewMessage');
|
$out .= $langs->trans('TicketNewMessage');
|
||||||
} elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
|
} elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
|
||||||
$out .= $langs->trans('TicketNewMessage').' <em>('.$langs->trans('Private').')</em>';
|
$out .= $langs->trans('TicketNewMessage').' <em>('.$langs->trans('Private').')</em>';
|
||||||
} else {
|
} elseif (isset($histo[$key]['type'])) {
|
||||||
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
|
if ($histo[$key]['type'] == 'action') {
|
||||||
$transcode = $langs->trans("Action".$histo[$key]['acode']);
|
$transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']);
|
||||||
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
|
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
|
||||||
$libelle = $histo[$key]['note'];
|
$libelle = $histo[$key]['note'];
|
||||||
$actionstatic->id = $histo[$key]['id'];
|
$actionstatic->id = $histo[$key]['id'];
|
||||||
$out .= dol_trunc($libelle, 120);
|
$out .= dol_escape_htmltag(dol_trunc($libelle, 120));
|
||||||
}
|
} elseif ($histo[$key]['type'] == 'mailing') {
|
||||||
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
|
|
||||||
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
|
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
|
||||||
$transcode = $langs->trans("Action".$histo[$key]['acode']);
|
$transcode = $langs->transnoentitiesnoconv("Action".$histo[$key]['acode']);
|
||||||
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
|
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
|
||||||
$out .= dol_trunc($libelle, 120);
|
$out .= dol_escape_htmltag(dol_trunc($libelle, 120));
|
||||||
|
} else {
|
||||||
|
$libelle .= $histo[$key]['note'];
|
||||||
|
$out .= dol_escape_htmltag(dol_trunc($libelle, 120));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12336,7 +12342,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||||||
|
|
||||||
$out .= '</h3>';
|
$out .= '</h3>';
|
||||||
|
|
||||||
if (!empty($histo[$key]['message'])
|
if (!empty($histo[$key]['message'] && $histo[$key]['message'] != $libelle)
|
||||||
&& $actionstatic->code != 'AC_TICKET_CREATE'
|
&& $actionstatic->code != 'AC_TICKET_CREATE'
|
||||||
&& $actionstatic->code != 'AC_TICKET_MODIFY'
|
&& $actionstatic->code != 'AC_TICKET_MODIFY'
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -118,7 +118,6 @@ function facture_prepare_head($object)
|
|||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans("Events");
|
$head[$h][1] = $langs->trans("Events");
|
||||||
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||||
|
|||||||
@ -126,16 +126,38 @@ function member_prepare_head(Adherent $object)
|
|||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
// Show agenda tab
|
// Show agenda tab
|
||||||
if (isModEnabled('agenda')) {
|
$head[$h][0] = DOL_URL_ROOT.'/adherents/agenda.php?id='.$object->id;
|
||||||
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
|
$head[$h][1] = $langs->trans("Events");
|
||||||
$head[$h][1] = $langs->trans("Events");
|
if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||||
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
$nbEvent = 0;
|
||||||
$head[$h][1] .= '/';
|
// Enable caching of thirdparty count actioncomm
|
||||||
$head[$h][1] .= $langs->trans("Agenda");
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||||
|
$cachekey = 'count_events_member_'.$object->id;
|
||||||
|
$dataretrieved = dol_getcache($cachekey);
|
||||||
|
if (!is_null($dataretrieved)) {
|
||||||
|
$nbEvent = $dataretrieved;
|
||||||
|
} else {
|
||||||
|
$sql = "SELECT COUNT(id) as nb";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
|
||||||
|
$sql .= " WHERE elementtype = 'member' AND fk_element = ".((int) $object->id);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nbEvent = $obj->nb;
|
||||||
|
} else {
|
||||||
|
dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
|
||||||
|
}
|
||||||
|
dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||||
|
}
|
||||||
|
|
||||||
|
$head[$h][1] .= '/';
|
||||||
|
$head[$h][1] .= $langs->trans("Agenda");
|
||||||
|
if ($nbEvent > 0) {
|
||||||
|
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbEvent.'</span>';
|
||||||
}
|
}
|
||||||
$head[$h][2] = 'agenda';
|
|
||||||
$h++;
|
|
||||||
}
|
}
|
||||||
|
$head[$h][2] = 'agenda';
|
||||||
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'add', 'external');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'add', 'external');
|
||||||
|
|
||||||
|
|||||||
@ -124,7 +124,7 @@ if ($nolinesbefore) {
|
|||||||
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
|
<?php if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
|
||||||
<td class="linecoluht_currency right"><span id="title_up_ht_currency"><?php echo $langs->trans('PriceUHTCurrency'); ?></span></td>
|
<td class="linecoluht_currency right"><span id="title_up_ht_currency"><?php echo $langs->trans('PriceUHTCurrency'); ?></span></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (!empty($inputalsopricewithtax)) { ?>
|
<?php if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
|
||||||
<td class="linecoluttc right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td>
|
<td class="linecoluttc right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td>
|
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td>
|
||||||
|
|||||||
@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal'));
|
$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal'));
|
||||||
|
|
||||||
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartyagenda';
|
||||||
|
|
||||||
if (GETPOST('actioncode', 'array')) {
|
if (GETPOST('actioncode', 'array')) {
|
||||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||||
@ -79,9 +80,16 @@ $socid = GETPOST('socid', 'int');
|
|||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$result = $object->fetch($socid);
|
||||||
|
if ($result <= 0) {
|
||||||
|
accessforbidden('Third party not found');
|
||||||
|
}
|
||||||
|
|
||||||
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
$result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
@ -114,109 +122,106 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if ($socid > 0) {
|
$title = $langs->trans("Agenda");
|
||||||
$result = $object->fetch($socid);
|
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
|
||||||
|
$title = $object->name." - ".$title;
|
||||||
|
}
|
||||||
|
$help_url = '';
|
||||||
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
$title = $langs->trans("Agenda");
|
if (isModEnabled('notification')) {
|
||||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
|
$langs->load("mails");
|
||||||
$title = $object->name." - ".$title;
|
}
|
||||||
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
|
|
||||||
|
print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto);
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
$morehtmlref = '';
|
||||||
|
|
||||||
|
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref);
|
||||||
|
|
||||||
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
|
$object->info($socid);
|
||||||
|
dol_print_object_info($object, 1);
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Actions buttons
|
||||||
|
|
||||||
|
$objthirdparty = $object;
|
||||||
|
$objcon = new stdClass();
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
$permok = $user->hasRight('agenda', 'myactions', 'create');
|
||||||
|
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
||||||
|
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
|
||||||
|
$out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
|
||||||
}
|
}
|
||||||
$help_url = '';
|
$out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '');
|
||||||
llxHeader('', $title, $help_url);
|
$out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog');
|
||||||
|
}
|
||||||
|
|
||||||
if (isModEnabled('notification')) {
|
$morehtmlright = '';
|
||||||
$langs->load("mails");
|
|
||||||
}
|
|
||||||
$head = societe_prepare_head($object);
|
|
||||||
|
|
||||||
|
$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
|
||||||
|
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
|
||||||
|
$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
|
||||||
|
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto);
|
// // Show link to send an email (if read and not closed)
|
||||||
|
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
|
||||||
|
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
|
||||||
|
// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
// // Show link to add a private message (if read and not closed)
|
||||||
|
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
|
||||||
|
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
|
||||||
|
// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
|
||||||
|
|
||||||
$morehtmlref = '';
|
if (isModEnabled('agenda')) {
|
||||||
|
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref);
|
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
|
||||||
|
|
||||||
$object->info($socid);
|
|
||||||
dol_print_object_info($object, 1);
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Actions buttons
|
|
||||||
|
|
||||||
$objthirdparty = $object;
|
|
||||||
$objcon = new stdClass();
|
|
||||||
|
|
||||||
$out = '';
|
|
||||||
$permok = $user->hasRight('agenda', 'myactions', 'create');
|
|
||||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
|
||||||
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
|
|
||||||
$out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
|
|
||||||
}
|
|
||||||
$out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '');
|
|
||||||
$out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog');
|
|
||||||
}
|
|
||||||
|
|
||||||
$morehtmlright = '';
|
|
||||||
|
|
||||||
$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
|
|
||||||
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
|
|
||||||
$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
|
|
||||||
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
|
|
||||||
|
|
||||||
// // Show link to send an email (if read and not closed)
|
|
||||||
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
|
|
||||||
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
|
|
||||||
// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
|
|
||||||
|
|
||||||
// // Show link to add a private message (if read and not closed)
|
|
||||||
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
|
|
||||||
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
|
|
||||||
// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
|
|
||||||
|
|
||||||
if (isModEnabled('agenda')) {
|
|
||||||
if (!empty($user->rights->agenda->myactions->create) || $user->hasRight('agenda', 'allactions', 'create')) {
|
|
||||||
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
$param = '&socid='.urlencode($socid);
|
|
||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
||||||
$param .= '&contextpage='.urlencode($contextpage);
|
|
||||||
}
|
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
||||||
$param .= '&limit='.urlencode($limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to know count of actioncomm from cache
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
|
||||||
$cachekey = 'count_events_thirdparty_'.$object->id;
|
|
||||||
$nbEvent = dol_getcache($cachekey);
|
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
|
|
||||||
|
|
||||||
// List of all actions
|
|
||||||
$filters = array();
|
|
||||||
$filters['search_agenda_label'] = $search_agenda_label;
|
|
||||||
$filters['search_rowid'] = $search_rowid;
|
|
||||||
|
|
||||||
// TODO Replace this with same code than into list.php
|
|
||||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
$param = '&socid='.urlencode($socid);
|
||||||
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||||
|
$param .= '&contextpage='.urlencode($contextpage);
|
||||||
|
}
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||||
|
$param .= '&limit='.urlencode($limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to know count of actioncomm from cache
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||||
|
$cachekey = 'count_events_thirdparty_'.$object->id;
|
||||||
|
$nbEvent = dol_getcache($cachekey);
|
||||||
|
|
||||||
|
print_barre_liste($langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
|
||||||
|
|
||||||
|
// List of all actions
|
||||||
|
$filters = array();
|
||||||
|
$filters['search_agenda_label'] = $search_agenda_label;
|
||||||
|
$filters['search_rowid'] = $search_rowid;
|
||||||
|
|
||||||
|
// TODO Replace this with same code than into list.php
|
||||||
|
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user