forked from Wavyzz/dolibarr
Merge branch 'develop' into actionrefused
This commit is contained in:
@@ -724,15 +724,18 @@ function defaultvalues_prepare_head()
|
||||
$head[$h][2] = 'sortorder';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus";
|
||||
$head[$h][1] = $langs->trans("DefaultFocus");
|
||||
$head[$h][2] = 'focus';
|
||||
$h++;
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus";
|
||||
$head[$h][1] = $langs->trans("DefaultFocus");
|
||||
$head[$h][2] = 'focus';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=mandatory";
|
||||
$head[$h][1] = $langs->trans("DefaultMandatory");
|
||||
$head[$h][2] = 'mandatory';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=mandatory";
|
||||
$head[$h][1] = $langs->trans("DefaultMandatory");
|
||||
$head[$h][2] = 'mandatory';
|
||||
$h++;
|
||||
}
|
||||
|
||||
/*$head[$h][0] = DOL_URL_ROOT."/admin/translation.php?mode=searchkey";
|
||||
$head[$h][1] = $langs->trans("TranslationKeySearch");
|
||||
|
||||
@@ -64,7 +64,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<input type="hidden" name="month" value="' . $month . '">';
|
||||
print '<input type="hidden" name="day" value="' . $day . '">';
|
||||
print '<input type="hidden" name="action" value="' . $action . '">';
|
||||
print '<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
|
||||
print '<input type="hidden" name="search_showbirthday" value="' . $showbirthday . '">';
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@@ -79,7 +79,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("ActionsToDoBy").' ';
|
||||
print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $form->select_dolusers($filtert, 'filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print $form->select_dolusers($filtert, 'search_filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
if (empty($conf->dol_optimize_smallscreen)) print ' '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' ';
|
||||
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
|
||||
print '</td></tr>';
|
||||
@@ -94,7 +94,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("Resource");
|
||||
print ' </td><td class="nowrap maxwidthonsmartphone" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $formresource->select_resource_list($resourceid, "resourceid", '', 1, 0, 0, null, '', 2);
|
||||
print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
$multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
|
||||
}
|
||||
print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
|
||||
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("ThirdParty").' ';
|
||||
print '</td><td class="nowrap" style="padding-bottom: 2px;">';
|
||||
print $form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0);
|
||||
print $form->select_company($socid, 'search_socid', '', 'SelectThirdParty', 0, 0, null, 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px;">';
|
||||
print $langs->trans("Project").' ';
|
||||
print '</td><td class="nowrap" style="padding-bottom: 2px;">';
|
||||
print $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print $formproject->select_projects($socid?$socid:-1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("Status");
|
||||
print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2, 'minwidth100');
|
||||
$formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
||||
|
||||
// select2 disabled for smartphones with standard browser.
|
||||
// TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
|
||||
if ($conf->browser->layout == 'phone') return '';
|
||||
if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone') return '';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
|
||||
if (empty($conf->use_javascript_ajax)) return '';
|
||||
|
||||
@@ -1286,8 +1286,8 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param mixed $filterobj Object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource
|
||||
* @param Contact $objcon Object contact
|
||||
* @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object
|
||||
* @param Contact $objcon Filter on object contact to filter events on a contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @param string $actioncode Filter on actioncode
|
||||
* @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all).
|
||||
@@ -1295,11 +1295,10 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @return mixed Return html part or void if noprint is 1
|
||||
* TODO change function to be able to list event linked to an object.
|
||||
*/
|
||||
function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC')
|
||||
{
|
||||
global $user,$conf;
|
||||
global $user, $conf;
|
||||
global $form;
|
||||
|
||||
global $param;
|
||||
@@ -1317,8 +1316,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
// Recherche histo sur actioncomm
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
$sql.= " a.datep as dp,";
|
||||
if (is_object($objcon) && $objcon->id) {
|
||||
$sql = "SELECT DISTINCT a.id, a.label,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT a.id, a.label,";
|
||||
}
|
||||
$sql.= " a.datep as dp,";
|
||||
$sql.= " a.datep2 as dp2,";
|
||||
$sql.= " a.note, a.percent,";
|
||||
$sql.= " a.fk_element, a.elementtype,";
|
||||
@@ -1327,12 +1332,17 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') $sql.= ", o.ref";
|
||||
else $sql.= ", o.ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
|
||||
if (is_object($objcon) && $objcon->id) {
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
|
||||
}
|
||||
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
|
||||
$sql.= " ON er.resource_type = 'dolresource'";
|
||||
@@ -1342,9 +1352,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o";
|
||||
|
||||
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
|
||||
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
|
||||
{
|
||||
@@ -1361,8 +1372,19 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
|
||||
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||
}
|
||||
//TODO check how ot work with new table actioncomm_resources and multiple contact affectation
|
||||
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket')
|
||||
{
|
||||
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
|
||||
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||
}
|
||||
|
||||
// Work with new table actioncomm_resources and multiple contact affectation.
|
||||
if (is_object($objcon) && $objcon->id)
|
||||
{
|
||||
$sql.= " AND r.element_type = '" . $objcon->table_element . "'" .
|
||||
" AND r.fk_element = " . $objcon->id;
|
||||
}
|
||||
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
@@ -1386,6 +1408,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
|
||||
elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
|
||||
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
|
||||
|
||||
//TODO Add limit for thirdparty in contexte very all result
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
@@ -1517,7 +1541,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
if ($objcon && get_class($objcon) == 'Contact' && $filterobj && get_class($filterobj) == 'Societe')
|
||||
if ($objcon && get_class($objcon) == 'Contact' &&
|
||||
(is_null($filterobj) || get_class($filterobj) == 'Societe'))
|
||||
{
|
||||
$out.='<input type="hidden" name="id" value="'.$objcon->id.'" />';
|
||||
}
|
||||
|
||||
@@ -610,9 +610,9 @@ if (! function_exists('dol_getprefix'))
|
||||
{
|
||||
/**
|
||||
* Return a prefix to use for this Dolibarr instance, for session/cookie names or email id.
|
||||
* This prefix is valid in a web context only and is unique for instance and avoid conflict
|
||||
* between multi-instances, even when having two instances with one root dir or two instances
|
||||
* in virtual servers.
|
||||
* The prefix for session is unique in a web context only and is unique for instance and avoid conflict
|
||||
* between multi-instances, even when having two instances with one root dir or two instances in virtual servers.
|
||||
* The prefix for email is unique if MAIL_PREFIX_FOR_EMAIL_ID is set to a value, otherwise value may be same than other instance.
|
||||
*
|
||||
* @param string $mode '' (prefix for session name) or 'email' (prefix for email id)
|
||||
* @return string A calculated prefix
|
||||
@@ -621,11 +621,15 @@ if (! function_exists('dol_getprefix'))
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email
|
||||
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
|
||||
// If prefix is for email
|
||||
if ($mode == 'email')
|
||||
{
|
||||
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
|
||||
else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"];
|
||||
if (! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
|
||||
{
|
||||
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
|
||||
else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"];
|
||||
}
|
||||
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
}
|
||||
|
||||
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
|
||||
@@ -634,7 +638,7 @@ if (! function_exists('dol_getprefix'))
|
||||
// Use this for a "readable" cookie name
|
||||
//return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
}
|
||||
else return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2661,6 +2665,20 @@ function dol_print_ip($ip,$mode=0)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the IP of remote user.
|
||||
* Take HTTP_X_FORWARDED_FOR (defined when using proxy)
|
||||
* Then HTTP_CLIENT_IP if defined (rare)
|
||||
* Then REMOTE_ADDR (not way to be modified by user but may be wrong if using proxy)
|
||||
*
|
||||
* @return string Ip of remote user.
|
||||
*/
|
||||
function getUserRemoteIP()
|
||||
{
|
||||
$ip = empty($_SERVER['HTTP_X_FORWARDED_FOR'])? (empty($_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']):$_SERVER['HTTP_CLIENT_IP']) : $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
return $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a country code from IP. Empty string if not found.
|
||||
*
|
||||
@@ -2704,7 +2722,7 @@ function dol_user_country()
|
||||
$ret='';
|
||||
if (! empty($conf->geoipmaxmind->enabled))
|
||||
{
|
||||
$ip=$_SERVER["REMOTE_ADDR"];
|
||||
$ip=getUserRemoteIP();
|
||||
$datafile=$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
|
||||
//$ip='24.24.24.24';
|
||||
//$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat';
|
||||
@@ -2886,188 +2904,6 @@ function dol_substr($string, $start, $length, $stringencoding='', $trunconbytes=
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show a javascript graph.
|
||||
* Do not use this function anymore. Use DolGraph class instead.
|
||||
*
|
||||
* @param string $htmlid Html id name
|
||||
* @param int $width Width in pixel
|
||||
* @param int $height Height in pixel
|
||||
* @param array $data Data array
|
||||
* @param int $showlegend 1 to show legend, 0 otherwise
|
||||
* @param string $type Type of graph ('pie', 'barline')
|
||||
* @param int $showpercent Show percent (with type='pie' only)
|
||||
* @param string $url Param to add an url to click values
|
||||
* @param int $combineother 0=No combine, 0.05=Combine if lower than 5%
|
||||
* @param int $shownographyet Show graph to say there is not enough data
|
||||
* @return void
|
||||
* @deprecated
|
||||
* @see DolGraph
|
||||
*/
|
||||
function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',$showpercent=0,$url='',$combineother=0.05,$shownographyet=0)
|
||||
{
|
||||
dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
|
||||
|
||||
global $conf,$langs;
|
||||
global $theme_datacolor; // To have var kept when function is called several times
|
||||
|
||||
if ($shownographyet)
|
||||
{
|
||||
print '<div class="nographyet" style="width:'.$width.'px;height:'.$height.'px;"></div>';
|
||||
print '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) return;
|
||||
$jsgraphlib='flot';
|
||||
$datacolor=array();
|
||||
|
||||
// Load colors of theme into $datacolor array
|
||||
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
|
||||
if (is_readable($color_file))
|
||||
{
|
||||
include_once $color_file;
|
||||
if (isset($theme_datacolor))
|
||||
{
|
||||
$datacolor=array();
|
||||
foreach($theme_datacolor as $val)
|
||||
{
|
||||
$datacolor[]="#".sprintf("%02x",$val[0]).sprintf("%02x",$val[1]).sprintf("%02x",$val[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<div id="'.$htmlid.'" style="width:'.$width.'px;height:'.$height.'px;"></div>';
|
||||
|
||||
// We use Flot js lib
|
||||
if ($jsgraphlib == 'flot')
|
||||
{
|
||||
if ($type == 'pie')
|
||||
{
|
||||
// data is array('series'=>array(serie1,serie2,...),
|
||||
// 'seriestype'=>array('bar','line',...),
|
||||
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
|
||||
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
|
||||
// serieX is array('label'=>'label', data=>val)
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var data = '.json_encode($data['series']).';
|
||||
|
||||
function plotWithOptions() {
|
||||
$.plot($("#'.$htmlid.'"), data,
|
||||
{
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 0.8,';
|
||||
if ($combineother)
|
||||
{
|
||||
print '
|
||||
combine: {
|
||||
threshold: '.$combineother.'
|
||||
},';
|
||||
}
|
||||
print '
|
||||
label: {
|
||||
show: true,
|
||||
radius: 0.9,
|
||||
formatter: function(label, series) {
|
||||
var percent=Math.round(series.percent);
|
||||
var number=series.data[0][1];
|
||||
return \'';
|
||||
print '<div style="font-size:8pt;text-align:center;padding:2px;color:black;">';
|
||||
if ($url) print '<a style="color: #FFFFFF;" border="0" href="'.$url.'">';
|
||||
print '\'+'.($showlegend?'number':'label+\' \'+number');
|
||||
if (! empty($showpercent)) print '+\'<br/>\'+percent+\'%\'';
|
||||
print '+\'';
|
||||
if ($url) print '</a>';
|
||||
print '</div>\';
|
||||
},
|
||||
background: {
|
||||
opacity: 0.0,
|
||||
color: \'#000000\'
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
zoom: {
|
||||
interactive: true
|
||||
},
|
||||
pan: {
|
||||
interactive: true
|
||||
},';
|
||||
if (count($datacolor))
|
||||
{
|
||||
print 'colors: '.(! empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)).',';
|
||||
}
|
||||
print 'legend: {show: '.($showlegend?'true':'false').', position: \'ne\' }
|
||||
});
|
||||
}
|
||||
plotWithOptions();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else if ($type == 'barline')
|
||||
{
|
||||
// data is array('series'=>array(serie1,serie2,...),
|
||||
// 'seriestype'=>array('bar','line',...),
|
||||
// 'seriescolor'=>array(0=>'#999999',1=>'#999999',...)
|
||||
// 'xlabel'=>array(0=>labelx1,1=>labelx2,...));
|
||||
// serieX is array('label'=>'label', data=>array(0=>y1,1=>y2,...)) with same nb of value than into xlabel
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var data = [';
|
||||
$i=0; $outputserie=0;
|
||||
foreach($data['series'] as $serie)
|
||||
{
|
||||
if ($data['seriestype'][$i]=='line') { $i++; continue; };
|
||||
if ($outputserie > 0) print ',';
|
||||
print '{ bars: { stack: 0, show: true, barWidth: 0.9, align: \'center\' }, label: \''.dol_escape_js($serie['label']).'\', data: '.json_encode($serie['data']).'}'."\n";
|
||||
$outputserie++; $i++;
|
||||
}
|
||||
if ($outputserie) print ', ';
|
||||
//print '];
|
||||
//var datalines = [';
|
||||
$i=0; $outputserie=0;
|
||||
foreach($data['series'] as $serie)
|
||||
{
|
||||
if (empty($data['seriestype'][$i]) || $data['seriestype'][$i]=='bar') { $i++; continue; };
|
||||
if ($outputserie > 0) print ',';
|
||||
print '{ lines: { show: true }, label: \''.dol_escape_js($serie['label']).'\', data: '.json_encode($serie['data']).'}'."\n";
|
||||
$outputserie++; $i++;
|
||||
}
|
||||
print '];
|
||||
var dataticks = '.json_encode($data['xlabel']).'
|
||||
|
||||
function plotWithOptions() {
|
||||
$.plot(jQuery("#'.$htmlid.'"), data,
|
||||
{
|
||||
series: {
|
||||
stack: 0
|
||||
},
|
||||
zoom: {
|
||||
interactive: true
|
||||
},
|
||||
pan: {
|
||||
interactive: true
|
||||
},';
|
||||
if (count($datacolor))
|
||||
{
|
||||
print 'colors: '.json_encode($datacolor).',';
|
||||
}
|
||||
print 'legend: {show: '.($showlegend?'true':'false').'},
|
||||
xaxis: {ticks: dataticks}
|
||||
});
|
||||
}
|
||||
plotWithOptions();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
else print 'BadValueForParameterType';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncate a string to a particular length adding '...' if string larger than length.
|
||||
* If length = max length+1, we do no truncate to avoid having just 1 char replaced with '...'.
|
||||
@@ -3174,7 +3010,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
if (empty($srconly) && in_array($pictowithoutext, array(
|
||||
'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize',
|
||||
'note','switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow',
|
||||
'skype','twitter','facebook'
|
||||
'jabber','skype','twitter','facebook'
|
||||
)
|
||||
)) {
|
||||
$fakey = $pictowithoutext;
|
||||
@@ -3257,10 +3093,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
elseif ($pictowithoutext == 'playdisabled') {
|
||||
$fakey = 'fa-play';
|
||||
$facolor = '#ccc';
|
||||
} elseif ($pictowithoutext == 'play') {
|
||||
}
|
||||
elseif ($pictowithoutext == 'play') {
|
||||
$fakey = 'fa-play';
|
||||
$facolor = '#444';
|
||||
}
|
||||
elseif ($pictowithoutext == 'jabber') {
|
||||
$fakey = 'fa-comment-o';
|
||||
}
|
||||
else {
|
||||
$fakey = 'fa-'.$pictowithoutext;
|
||||
$facolor = '#444';
|
||||
@@ -4218,10 +4058,10 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
|
||||
if ($picto == 'setup') $picto='title_generic.png';
|
||||
|
||||
$return.= "\n";
|
||||
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 2px;"><tr>';
|
||||
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" class="centpercent notopnoleftnoright'.($morecssontable?' '.$morecssontable:'').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list
|
||||
if ($picto) $return.= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('',$picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>';
|
||||
$return.= '<td class="nobordernopadding" valign="middle">';
|
||||
$return.= '<div class="titre">'.$titre.'</div>';
|
||||
$return.= '<td class="nobordernopadding valignmiddle">';
|
||||
$return.= '<div class="titre inline-block">'.$titre.'</div>';
|
||||
$return.= '</td>';
|
||||
if (dol_strlen($morehtmlcenter))
|
||||
{
|
||||
@@ -4280,7 +4120,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
|
||||
print "\n";
|
||||
print "<!-- Begin title '".$titre."' -->\n";
|
||||
print '<table width="100%" border="0" class="notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>';
|
||||
print '<table border="0" class="centpercent notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire
|
||||
|
||||
// Left
|
||||
//if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>';
|
||||
@@ -4980,7 +4820,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
{
|
||||
$vatratecleaned = $vatrate;
|
||||
$vatratecode = '';
|
||||
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
|
||||
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)"
|
||||
{
|
||||
$vatratecleaned = $reg[1];
|
||||
$vatratecode = $reg[2];
|
||||
@@ -5909,7 +5749,7 @@ function dol_textishtml($msg,$option=0)
|
||||
*
|
||||
* @param string $text1 Text 1
|
||||
* @param string $text2 Text 2
|
||||
* @param bool $forxml false=Use <br>, true=Use <br />
|
||||
* @param bool $forxml false=Use <br> instead of \n if html content detected, true=Use <br /> instead of \n if html content detected
|
||||
* @return string Text 1 + new line + Text2
|
||||
* @see dol_textishtml
|
||||
*/
|
||||
@@ -5961,7 +5801,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
'__USER_FIRSTNAME__' => (string) $user->firstname,
|
||||
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'),
|
||||
'__USER_REMOTE_IP__' => (string) $_SERVER['REMOTE_ADDR']
|
||||
'__USER_REMOTE_IP__' => (string) getUserRemoteIP()
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -6026,6 +5866,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice';
|
||||
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service';
|
||||
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = 'Direct download url of a proposal';
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = 'Direct download url of an order';
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = 'Direct download url of an invoice';
|
||||
|
||||
if (is_object($object) && $object->element == 'shipping')
|
||||
{
|
||||
$substitutionarray['__SHIPPINGTRACKNUM__']='Shipping tacking number';
|
||||
@@ -6039,7 +5883,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
|
||||
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
|
||||
|
||||
// TODO Use this ?
|
||||
// TODO Remove this
|
||||
$msgishtml = 0;
|
||||
|
||||
$birthday = dol_print_date($object->birth,'day');
|
||||
@@ -6150,6 +5994,22 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
|
||||
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):'');
|
||||
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
|
||||
|
||||
if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal')
|
||||
{
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element);
|
||||
}
|
||||
else $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = '';
|
||||
if (! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'commande')
|
||||
{
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = $object->getLastMainDocLink($object->element);
|
||||
}
|
||||
else $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = '';
|
||||
if (! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'facture')
|
||||
{
|
||||
$substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element);
|
||||
}
|
||||
else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = '';
|
||||
}
|
||||
}
|
||||
if (empty($exclude) || ! in_array('objectamount', $exclude))
|
||||
@@ -6210,16 +6070,16 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
));
|
||||
}
|
||||
|
||||
if (empty($exclude) || ! in_array('system', $exclude))
|
||||
{
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey');
|
||||
$substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstant');
|
||||
$substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT;
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
{
|
||||
$substitutionarray=array_merge($substitutionarray, array('__ENTITY_ID__' => $conf->entity));
|
||||
}
|
||||
if (empty($exclude) || ! in_array('system', $exclude))
|
||||
{
|
||||
$substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT;
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey');
|
||||
$substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstantKey');
|
||||
}
|
||||
|
||||
return $substitutionarray;
|
||||
}
|
||||
@@ -6928,6 +6788,215 @@ function picto_from_langcode($codelang, $moreatt = '')
|
||||
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return default language from country code
|
||||
*
|
||||
* @param string $countrycode Country code like 'US', 'FR', 'CA', ...
|
||||
* @return string Value of locale like 'en_US', 'fr_FR', ...
|
||||
*/
|
||||
function getLanguageCodeFromCountryCode($countrycode)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
if (strtoupper($countrycode) == 'MQ') return 'fr_CA';
|
||||
if (strtoupper($countrycode) == 'SE') return 'sv_SE'; // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country
|
||||
if (strtoupper($countrycode) == 'CH')
|
||||
{
|
||||
if ($mysoc->country_code == 'FR') return 'fr_CH';
|
||||
if ($mysoc->country_code == 'DE') return 'de_CH';
|
||||
}
|
||||
|
||||
// Locale list taken from:
|
||||
// http://stackoverflow.com/questions/3191664/
|
||||
// list-of-all-locales-and-their-short-codes
|
||||
$locales = array(
|
||||
'af-ZA',
|
||||
'am-ET',
|
||||
'ar-AE',
|
||||
'ar-BH',
|
||||
'ar-DZ',
|
||||
'ar-EG',
|
||||
'ar-IQ',
|
||||
'ar-JO',
|
||||
'ar-KW',
|
||||
'ar-LB',
|
||||
'ar-LY',
|
||||
'ar-MA',
|
||||
'ar-OM',
|
||||
'ar-QA',
|
||||
'ar-SA',
|
||||
'ar-SY',
|
||||
'ar-TN',
|
||||
'ar-YE',
|
||||
'as-IN',
|
||||
'ba-RU',
|
||||
'be-BY',
|
||||
'bg-BG',
|
||||
'bn-BD',
|
||||
'bn-IN',
|
||||
'bo-CN',
|
||||
'br-FR',
|
||||
'ca-ES',
|
||||
'co-FR',
|
||||
'cs-CZ',
|
||||
'cy-GB',
|
||||
'da-DK',
|
||||
'de-AT',
|
||||
'de-CH',
|
||||
'de-DE',
|
||||
'de-LI',
|
||||
'de-LU',
|
||||
'dv-MV',
|
||||
'el-GR',
|
||||
'en-AU',
|
||||
'en-BZ',
|
||||
'en-CA',
|
||||
'en-GB',
|
||||
'en-IE',
|
||||
'en-IN',
|
||||
'en-JM',
|
||||
'en-MY',
|
||||
'en-NZ',
|
||||
'en-PH',
|
||||
'en-SG',
|
||||
'en-TT',
|
||||
'en-US',
|
||||
'en-ZA',
|
||||
'en-ZW',
|
||||
'es-AR',
|
||||
'es-BO',
|
||||
'es-CL',
|
||||
'es-CO',
|
||||
'es-CR',
|
||||
'es-DO',
|
||||
'es-EC',
|
||||
'es-ES',
|
||||
'es-GT',
|
||||
'es-HN',
|
||||
'es-MX',
|
||||
'es-NI',
|
||||
'es-PA',
|
||||
'es-PE',
|
||||
'es-PR',
|
||||
'es-PY',
|
||||
'es-SV',
|
||||
'es-US',
|
||||
'es-UY',
|
||||
'es-VE',
|
||||
'et-EE',
|
||||
'eu-ES',
|
||||
'fa-IR',
|
||||
'fi-FI',
|
||||
'fo-FO',
|
||||
'fr-BE',
|
||||
'fr-CA',
|
||||
'fr-CH',
|
||||
'fr-FR',
|
||||
'fr-LU',
|
||||
'fr-MC',
|
||||
'fy-NL',
|
||||
'ga-IE',
|
||||
'gd-GB',
|
||||
'gl-ES',
|
||||
'gu-IN',
|
||||
'he-IL',
|
||||
'hi-IN',
|
||||
'hr-BA',
|
||||
'hr-HR',
|
||||
'hu-HU',
|
||||
'hy-AM',
|
||||
'id-ID',
|
||||
'ig-NG',
|
||||
'ii-CN',
|
||||
'is-IS',
|
||||
'it-CH',
|
||||
'it-IT',
|
||||
'ja-JP',
|
||||
'ka-GE',
|
||||
'kk-KZ',
|
||||
'kl-GL',
|
||||
'km-KH',
|
||||
'kn-IN',
|
||||
'ko-KR',
|
||||
'ky-KG',
|
||||
'lb-LU',
|
||||
'lo-LA',
|
||||
'lt-LT',
|
||||
'lv-LV',
|
||||
'mi-NZ',
|
||||
'mk-MK',
|
||||
'ml-IN',
|
||||
'mn-MN',
|
||||
'mr-IN',
|
||||
'ms-BN',
|
||||
'ms-MY',
|
||||
'mt-MT',
|
||||
'nb-NO',
|
||||
'ne-NP',
|
||||
'nl-BE',
|
||||
'nl-NL',
|
||||
'nn-NO',
|
||||
'oc-FR',
|
||||
'or-IN',
|
||||
'pa-IN',
|
||||
'pl-PL',
|
||||
'ps-AF',
|
||||
'pt-BR',
|
||||
'pt-PT',
|
||||
'rm-CH',
|
||||
'ro-RO',
|
||||
'ru-RU',
|
||||
'rw-RW',
|
||||
'sa-IN',
|
||||
'se-FI',
|
||||
'se-NO',
|
||||
'se-SE',
|
||||
'si-LK',
|
||||
'sk-SK',
|
||||
'sl-SI',
|
||||
'sq-AL',
|
||||
'sv-FI',
|
||||
'sv-SE',
|
||||
'sw-KE',
|
||||
'ta-IN',
|
||||
'te-IN',
|
||||
'th-TH',
|
||||
'tk-TM',
|
||||
'tn-ZA',
|
||||
'tr-TR',
|
||||
'tt-RU',
|
||||
'ug-CN',
|
||||
'uk-UA',
|
||||
'ur-PK',
|
||||
'vi-VN',
|
||||
'wo-SN',
|
||||
'xh-ZA',
|
||||
'yo-NG',
|
||||
'zh-CN',
|
||||
'zh-HK',
|
||||
'zh-MO',
|
||||
'zh-SG',
|
||||
'zh-TW',
|
||||
'zu-ZA',
|
||||
);
|
||||
|
||||
$buildprimarykeytotest = strtolower($countrycode).'-'.strtoupper($countrycode);
|
||||
if (in_array($buildprimarykeytotest, $locales)) return strtolower($countrycode).'_'.strtoupper($countrycode);
|
||||
|
||||
foreach ($locales as $locale)
|
||||
{
|
||||
$locale_language = locale_get_primary_language($locale);
|
||||
$locale_region = locale_get_region($locale);
|
||||
if (strtoupper($countrycode) == $locale_region)
|
||||
{
|
||||
//var_dump($locale.'-'.$locale_language.'-'.$locale_region);
|
||||
return strtolower($locale_language).'_'.strtoupper($locale_region);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete or removed entries into a head array (used to build tabs).
|
||||
* For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab'].
|
||||
|
||||
@@ -50,13 +50,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
*/
|
||||
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $filesuffix='', $paymentbankid='', $thirdpartiesid='', $fileprefix='mergedpdf')
|
||||
{
|
||||
$sql = "SELECT DISTINCT f.rowid, f.facnumber";
|
||||
$sql = "SELECT DISTINCT f.rowid, f.ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sqlwhere='';
|
||||
$sqlorder='';
|
||||
if (in_array('all',$filter))
|
||||
{
|
||||
$sqlorder = " ORDER BY f.facnumber ASC";
|
||||
$sqlorder = " ORDER BY f.ref ASC";
|
||||
}
|
||||
if (in_array('date',$filter))
|
||||
{
|
||||
@@ -175,11 +175,11 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
||||
$filename=$conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
|
||||
if ($regenerate || ! dol_is_file($filename))
|
||||
{
|
||||
if ($usestdout) print "Build PDF for invoice ".$obj->facnumber." - Lang = ".$outputlangs->defaultlang."\n";
|
||||
if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
|
||||
$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
|
||||
}
|
||||
else {
|
||||
if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n";
|
||||
if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
|
||||
}
|
||||
|
||||
// Add file into files array
|
||||
|
||||
@@ -40,6 +40,11 @@ function loan_prepare_head($object)
|
||||
$head[$tab][1] = $langs->trans('Card');
|
||||
$head[$tab][2] = 'card';
|
||||
$tab++;
|
||||
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/schedule.php?loanid='.$object->id;
|
||||
$head[$tab][1] = $langs->trans('FinancialCommitment');
|
||||
$head[$tab][2] = 'FinancialCommitment';
|
||||
$tab++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
|
||||
@@ -728,7 +728,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
$cury+=3;
|
||||
}
|
||||
|
||||
if (empty($conf->global->PDF_BANK_HIDE_NUMBER_SHOW_ONLY_BICIBAN)) // Note that some countries still need bank number, BIC/IBAN not enought for them
|
||||
if (empty($conf->global->PDF_BANK_HIDE_NUMBER_SHOW_ONLY_BICIBAN)) // Note that some countries still need bank number, BIC/IBAN not enougth for them
|
||||
{
|
||||
// Note:
|
||||
// bank = code_banque (FR), sort code (GB, IR. Example: 12-34-56)
|
||||
@@ -757,7 +757,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
// Key
|
||||
$tmplength = 13;
|
||||
$tmplength = 15;
|
||||
$content = $account->cle_rib;
|
||||
}elseif ($val == 'IBAN' || $val == 'BIC') {
|
||||
// Key
|
||||
@@ -1347,6 +1347,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
||||
if (! empty($libelleproduitservice) && ! empty($ref_prodserv)) $ref_prodserv .= " - ";
|
||||
}
|
||||
|
||||
if(!empty($ref_prodserv) && !empty($conf->global->ADD_HTML_FORMATING_INTO_DESC_DOC)){ $ref_prodserv = '<b>'.$ref_prodserv.'</b>'; }
|
||||
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||
|
||||
// Add an additional description for the category products
|
||||
@@ -1382,7 +1383,11 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
||||
$period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')';
|
||||
}
|
||||
//print '>'.$outputlangs->charset_output.','.$period;
|
||||
if(!empty($conf->global->ADD_HTML_FORMATING_INTO_DESC_DOC)){
|
||||
$libelleproduitservice.= '<b style="color:#333666;" ><em>'."__N__</b> ".$period.'</em>';
|
||||
}else{
|
||||
$libelleproduitservice.="__N__".$period;
|
||||
}
|
||||
//print $libelleproduitservice;
|
||||
}
|
||||
|
||||
@@ -1514,7 +1519,7 @@ function pdf_getlineref_supplier($object,$i,$outputlangs,$hidedetails=0)
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
||||
function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails=0)
|
||||
{
|
||||
global $conf, $hookmanager, $mysoc;
|
||||
|
||||
@@ -1868,6 +1873,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
|
||||
{
|
||||
if (empty($hookmanager)) global $hookmanager;
|
||||
global $conf;
|
||||
|
||||
$reshook=0;
|
||||
$result='';
|
||||
|
||||
@@ -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].= ' <span class="badge">'.($nbTasks).'</span>';
|
||||
$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].= ' <span class="badge">...</span>';
|
||||
$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].= ' <span class="badge">'.($nbTasks).'</span>';
|
||||
$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].= ' <span class="badge">...</span>';
|
||||
$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)
|
||||
{
|
||||
|
||||
@@ -91,7 +91,7 @@ function report_header($reportname,$notused,$period,$periodlink,$description,$bu
|
||||
print '<td>'.$langs->trans("ReportPeriod").'</td>';
|
||||
print '<td>';
|
||||
if ($period) print $period;
|
||||
if ($variante) print '<td>'.$periodlink.'</td>';
|
||||
if ($variante) print '<td class="nowraponall">'.$periodlink.'</td>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ function dol_hash($chain, $type='0')
|
||||
* If constant MAIN_SECURITY_HASH_ALGO is defined, we use this function as hashing function.
|
||||
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
|
||||
*
|
||||
* @param string $chain String to hash
|
||||
* @param string $chain String to hash (not hashed string)
|
||||
* @param string $hash hash to compare
|
||||
* @param string $type Type of hash ('0':auto, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
|
||||
* @return bool True if the computed hash is the same as the given one
|
||||
|
||||
@@ -109,7 +109,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
|
||||
$total_tva='total_tva';
|
||||
$paymenttable='paiement';
|
||||
$paymentfacturetable='paiement_facture';
|
||||
$invoicefieldref='facnumber';
|
||||
$invoicefieldref='ref';
|
||||
}
|
||||
if ($direction == 'buy')
|
||||
{
|
||||
@@ -578,7 +578,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
$total_tva='total_tva';
|
||||
$paymenttable='paiement';
|
||||
$paymentfacturetable='paiement_facture';
|
||||
$invoicefieldref='facnumber';
|
||||
$invoicefieldref='ref';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ function ticket_prepare_head($object)
|
||||
|
||||
|
||||
// History
|
||||
$head[$h][0] = DOL_URL_ROOT.'/ticket/history.php?track_id=' . $object->track_id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/ticket/agenda.php?track_id=' . $object->track_id;
|
||||
$head[$h][1] = $langs->trans('Events');
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
|
||||
@@ -822,22 +822,22 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
if ($edit)
|
||||
{
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
|
||||
print $formother->selectColor($color,'THEME_ELDY_USE_HOVER','formcolor',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
|
||||
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0';
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
|
||||
if ($color)
|
||||
{
|
||||
if ($color != 'edf4fb') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
else print $langs->trans("None");
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>edf4fb</strong>) ';
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
@@ -866,22 +866,22 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
|
||||
//print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
|
||||
if ($edit)
|
||||
{
|
||||
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='ffefbb';
|
||||
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
|
||||
print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='ffefbb';
|
||||
if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='e6edf0';
|
||||
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),'');
|
||||
if ($color)
|
||||
{
|
||||
if ($color != 'ffefbb') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
if ($color != 'e6edf0') print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
|
||||
else print $langs->trans("Default");
|
||||
}
|
||||
else print $langs->trans("None");
|
||||
}
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>ffefbb</strong>) ';
|
||||
print ' <span class="nowraponall">('.$langs->trans("Default").': <strong>e6edf0</strong>) ';
|
||||
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
*/
|
||||
function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
|
||||
{
|
||||
$nbrep = 0;
|
||||
|
||||
// Replace php code. Note $content may come from database and does not contains body tags.
|
||||
$replacewith='...php...';
|
||||
if ($removephppart) $replacewith='';
|
||||
@@ -59,7 +61,12 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
|
||||
//$replacewith='<span class="phptag">...php...</span>';
|
||||
$replacewith='<span class="phptag">...php...</span>';
|
||||
if ($removephppart) $replacewith='';
|
||||
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
|
||||
//$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content);
|
||||
/*if ($content === null) {
|
||||
if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
|
||||
}*/
|
||||
$content = dolStripPhpCode($content, $replacewith);
|
||||
//var_dump($content);
|
||||
|
||||
// Replace relative link / with dolibarr URL
|
||||
$content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep);
|
||||
@@ -88,6 +95,45 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove PHP code part from a string.
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @param string $replacewith String to use as replacement
|
||||
* @return string Result string without php code
|
||||
*/
|
||||
function dolStripPhpCode($str, $replacewith='')
|
||||
{
|
||||
$newstr = '';
|
||||
|
||||
//split on each opening tag
|
||||
$parts = explode('<?php',$str);
|
||||
if (!empty($parts))
|
||||
{
|
||||
$i=0;
|
||||
foreach($parts as $part)
|
||||
{
|
||||
if ($i == 0) // The first part is never php code
|
||||
{
|
||||
$i++;
|
||||
$newstr .= $part;
|
||||
continue;
|
||||
}
|
||||
//split on closing tag
|
||||
$partlings = explode('?>', $part);
|
||||
if (!empty($partlings))
|
||||
{
|
||||
//remove content before closing tag
|
||||
if (count($partlings) > 1) $partlings[0] = '';
|
||||
//append to out string
|
||||
$newstr .= $replacewith.implode('',$partlings);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $newstr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render a string of an HTML content and output it.
|
||||
* Used to ouput the page when viewed from server (Dolibarr or Apache).
|
||||
|
||||
Reference in New Issue
Block a user