mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' into develop#3
This commit is contained in:
commit
33bb1919f0
|
|
@ -146,8 +146,7 @@ elseif ($action == 'setdoc')
|
|||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
} elseif ($action == 'unsetdoc')
|
||||
{
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
dolibarr_del_const($db, "INVOICE_SUPPLIER_ADDON_PDF", $conf->entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ $langs->load("admin");
|
|||
$action = GETPOST('action', 'aZ09');
|
||||
$what = GETPOST('what', 'alpha');
|
||||
$export_type = GETPOST('export_type', 'alpha');
|
||||
$file = GETPOST('zipfilename_template', 'alpha');
|
||||
$compression = GETPOST('compression');
|
||||
$file = trim(GETPOST('zipfilename_template', 'alpha'));
|
||||
$compression = GETPOST('compression', 'aZ09');
|
||||
|
||||
$file = dol_sanitizeFileName($file);
|
||||
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);
|
||||
|
|
|
|||
|
|
@ -497,6 +497,17 @@ class Documents extends DolibarrApi
|
|||
$filearray = dol_dir_list($upload_dir, $type, $recursive, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
if (empty($filearray)) {
|
||||
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->ref) ? ' or Ref '.$object->ref : '').' does not return any document.');
|
||||
} else {
|
||||
if (($object->id) > 0 && !empty($modulepart)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile = new EcmFiles($this->db);
|
||||
$result = $ecmfile->fetchAll('', '', 0, 0, array('t.src_object_type' => $modulepart, 't.src_object_id' => $object->id));
|
||||
if ($result < 0) {
|
||||
throw new RestException(503, 'Error when retrieve ecm list : ' . $this->db->lasterror());
|
||||
} elseif (is_array($ecmfile->lines) && count($ecmfile->lines) > 0) {
|
||||
$filearray['ecmfiles_infos'] = $ecmfile->lines;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $filearray;
|
||||
|
|
|
|||
|
|
@ -911,6 +911,7 @@ if (empty($reshook))
|
|||
if (count($prodcustprice->lines) > 0) {
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
$price_min = price($prodcustprice->lines[0]->price_min);
|
||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||
$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
|
||||
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||
|
|
|
|||
|
|
@ -749,6 +749,7 @@ if (empty($reshook))
|
|||
{
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
$price_min = price($prodcustprice->lines[0]->price_min);
|
||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
|
@ -122,8 +121,8 @@ if (empty($reshook))
|
|||
$object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
|
||||
$object->subledger_account = $subledger_account;
|
||||
|
||||
$object->sens = GETPOST('sens', 'int');
|
||||
$object->fk_project = GETPOST('fk_project', 'int');
|
||||
$object->sens = GETPOSTINT('sens');
|
||||
$object->fk_project = GETPOSTINT('fk_project');
|
||||
|
||||
if (empty($datep) || empty($datev))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2020 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
|
|
@ -2035,7 +2035,7 @@ if ($action == 'create')
|
|||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if ($object->statut == 1) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
|
||||
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,11 +315,15 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
|||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model = $object->model_pdf;
|
||||
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$model = $object->model_pdf;
|
||||
|
||||
$retgen = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($retgen < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ class box_funnel_of_prospection extends ModeleBoxes
|
|||
$sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_lead_status as cls";
|
||||
$sql .= " WHERE active=1";
|
||||
$sql .= " AND cls.code <> 'LOST'";
|
||||
$sql .= $this->db->order('cls.rowid', 'ASC');
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -124,7 +126,6 @@ class box_funnel_of_prospection extends ModeleBoxes
|
|||
$colorseriesstat[$objp->rowid] = $badgeStatus6;
|
||||
break;
|
||||
default:
|
||||
$colorseriesstat[$objp->rowid] = $badgeStatus2;
|
||||
break;
|
||||
}
|
||||
$i++;
|
||||
|
|
@ -134,12 +135,11 @@ class box_funnel_of_prospection extends ModeleBoxes
|
|||
}
|
||||
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max = $max;
|
||||
|
||||
$this->info_box_head = array(
|
||||
'text' => $langs->trans("Statistics") . ' - ' . $langs->trans("OpportunitiesStatusForOpenedProjects"),
|
||||
$max
|
||||
'text' => $langs->trans("Statistics") . ' - ' . $langs->trans("BoxTitleFunnelOfProspection"),
|
||||
'graph' => '1'
|
||||
);
|
||||
|
||||
if ($user->rights->projet->lire || !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
|
||||
|
|
@ -187,6 +187,8 @@ class box_funnel_of_prospection extends ModeleBoxes
|
|||
$stringtoprint = '';
|
||||
$stringtoprint .= '<div class="div-table-responsive-no-min ">';
|
||||
$listofstatus = array_keys($listofoppstatus);
|
||||
$liststatus = array();
|
||||
$data = array('');
|
||||
foreach ($listofstatus as $status) {
|
||||
$labelStatus = '';
|
||||
if ($status != 7) {
|
||||
|
|
@ -198,7 +200,8 @@ class box_funnel_of_prospection extends ModeleBoxes
|
|||
$labelStatus = $listofopplabel[$status];
|
||||
}
|
||||
|
||||
$dataseries[] = array($labelStatus,(isset($valsamount[$status]) ? (float) $valsamount[$status] : 0));
|
||||
$data[] = (isset($valsamount[$status]) ? (float) $valsamount[$status] : 0);
|
||||
$liststatus[] = $labelStatus;
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
$stringtoprint .= '<tr class="oddeven">';
|
||||
$stringtoprint .= '<td>' . $labelStatus . '</td>';
|
||||
|
|
@ -207,17 +210,22 @@ class box_funnel_of_prospection extends ModeleBoxes
|
|||
}
|
||||
}
|
||||
}
|
||||
$dataseries[] = $data;
|
||||
if ($conf->use_javascript_ajax) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetMinValue(0);
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->SetLegend($liststatus);
|
||||
$dolgraph->SetDataColor(array_values($colorseriesstat));
|
||||
//$dolgraph->SetLegend(array('PROSP',$dataseries['PROSP']));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setTitle('');
|
||||
$dolgraph->SetType(array('horizontalbars'));
|
||||
$dolgraph->SetHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
$dolgraph->SetWidth('600');
|
||||
$dolgraph->mode = 'depth';
|
||||
$dolgraph->draw('idgraphleadfunnel');
|
||||
$stringtoprint .= $dolgraph->show($totaloppnb ? 0 : 1);
|
||||
}
|
||||
$stringtoprint .= '</div>';
|
||||
|
|
|
|||
|
|
@ -4557,6 +4557,11 @@ abstract class CommonObject
|
|||
{
|
||||
dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null'));
|
||||
|
||||
if (empty($modele)) {
|
||||
$this->error = 'BadValueForParameterModele';
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Increase limit for PDF build
|
||||
$err = error_reporting();
|
||||
error_reporting(0);
|
||||
|
|
|
|||
|
|
@ -103,9 +103,8 @@ class DolGraph
|
|||
$this->datacolor = array(array(120, 130, 150), array(160, 160, 180), array(190, 190, 220));
|
||||
$this->bgcolor = array(235, 235, 224);
|
||||
|
||||
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
if (is_readable($color_file))
|
||||
{
|
||||
$color_file = DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
|
||||
if (is_readable($color_file)) {
|
||||
include_once $color_file;
|
||||
if (isset($theme_bordercolor)) $this->bordercolor = $theme_bordercolor;
|
||||
if (isset($theme_datacolor)) $this->datacolor = $theme_datacolor;
|
||||
|
|
@ -261,7 +260,7 @@ class DolGraph
|
|||
* Set type
|
||||
*
|
||||
* @param array $type Array with type for each serie. Example: array('type1', 'type2', ...) where type can be:
|
||||
* 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', 'horirontalbars'...
|
||||
* 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', 'horizontalbars'...
|
||||
* @return void
|
||||
*/
|
||||
public function SetType($type)
|
||||
|
|
@ -466,10 +465,8 @@ class DolGraph
|
|||
// phpcs:enable
|
||||
global $theme_bgcolor, $theme_bgcoloronglet;
|
||||
|
||||
if (!is_array($bg_color))
|
||||
{
|
||||
if ($bg_color == 'onglet')
|
||||
{
|
||||
if (!is_array($bg_color)) {
|
||||
if ($bg_color == 'onglet') {
|
||||
//print 'ee'.join(',',$theme_bgcoloronglet);
|
||||
$this->bgcolor = $theme_bgcoloronglet;
|
||||
} else {
|
||||
|
|
@ -492,10 +489,8 @@ class DolGraph
|
|||
// phpcs:enable
|
||||
global $theme_bgcolor, $theme_bgcoloronglet;
|
||||
|
||||
if (!is_array($bg_colorgrid))
|
||||
{
|
||||
if ($bg_colorgrid == 'onglet')
|
||||
{
|
||||
if (!is_array($bg_colorgrid)) {
|
||||
if ($bg_colorgrid == 'onglet') {
|
||||
//print 'ee'.join(',',$theme_bgcoloronglet);
|
||||
$this->bgcolorgrid = $theme_bgcoloronglet;
|
||||
} else {
|
||||
|
|
@ -535,10 +530,8 @@ class DolGraph
|
|||
$nblines = count($this->data);
|
||||
$nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1);
|
||||
|
||||
for ($j = 0; $j < $nblines; $j++)
|
||||
{
|
||||
for ($i = 0; $i < $nbvalues; $i++)
|
||||
{
|
||||
for ($j = 0; $j < $nblines; $j++) {
|
||||
for ($i = 0; $i < $nbvalues; $i++) {
|
||||
$vals[$k] = $this->data[$j][$i + 1];
|
||||
$k++;
|
||||
}
|
||||
|
|
@ -564,10 +557,8 @@ class DolGraph
|
|||
$nblines = count($this->data);
|
||||
$nbvalues = (empty($this->data[0]) ? 0 : count($this->data[0]) - 1);
|
||||
|
||||
for ($j = 0; $j < $nblines; $j++)
|
||||
{
|
||||
for ($i = 0; $i < $nbvalues; $i++)
|
||||
{
|
||||
for ($j = 0; $j < $nblines; $j++) {
|
||||
for ($i = 0; $i < $nbvalues; $i++) {
|
||||
$vals[$k] = $this->data[$j][$i + 1];
|
||||
$k++;
|
||||
}
|
||||
|
|
@ -589,8 +580,7 @@ class DolGraph
|
|||
if ($max != 0) $max++;
|
||||
$size = dol_strlen(abs(ceil($max)));
|
||||
$factor = 1;
|
||||
for ($i = 0; $i < ($size - 1); $i++)
|
||||
{
|
||||
for ($i = 0; $i < ($size - 1); $i++) {
|
||||
$factor *= 10;
|
||||
}
|
||||
|
||||
|
|
@ -615,8 +605,7 @@ class DolGraph
|
|||
if ($min != 0) $min--;
|
||||
$size = dol_strlen(abs(floor($min)));
|
||||
$factor = 1;
|
||||
for ($i = 0; $i < ($size - 1); $i++)
|
||||
{
|
||||
for ($i = 0; $i < ($size - 1); $i++) {
|
||||
$factor *= 10;
|
||||
}
|
||||
|
||||
|
|
@ -635,24 +624,21 @@ class DolGraph
|
|||
*/
|
||||
public function draw($file, $fileurl = '')
|
||||
{
|
||||
if (empty($file))
|
||||
{
|
||||
if (empty($file)) {
|
||||
$this->error = "Call to draw method was made with empty value for parameter file.";
|
||||
dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this) . "::draw " . $this->error, LOG_ERR);
|
||||
return -2;
|
||||
}
|
||||
if (!is_array($this->data))
|
||||
{
|
||||
if (!is_array($this->data)) {
|
||||
$this->error = "Call to draw method was made but SetData was not called or called with an empty dataset for parameters";
|
||||
dol_syslog(get_class($this)."::draw ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this) . "::draw " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (count($this->data) < 1)
|
||||
{
|
||||
if (count($this->data) < 1) {
|
||||
$this->error = "Call to draw method was made but SetData was is an empty dataset";
|
||||
dol_syslog(get_class($this)."::draw ".$this->error, LOG_WARNING);
|
||||
dol_syslog(get_class($this) . "::draw " . $this->error, LOG_WARNING);
|
||||
}
|
||||
$call = "draw_".$this->_library;
|
||||
$call = "draw_" . $this->_library;
|
||||
call_user_func_array(array($this, $call), array($file, $fileurl));
|
||||
}
|
||||
|
||||
|
|
@ -678,10 +664,9 @@ class DolGraph
|
|||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::draw_jflot this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
|
||||
dol_syslog(get_class($this) . "::draw_jflot this->type=" . join(',', $this->type) . " this->MaxValue=" . $this->MaxValue);
|
||||
|
||||
if (empty($this->width) && empty($this->height))
|
||||
{
|
||||
if (empty($this->width) && empty($this->height)) {
|
||||
print 'Error width or height not set';
|
||||
return;
|
||||
}
|
||||
|
|
@ -701,7 +686,7 @@ class DolGraph
|
|||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$values = array(); // Array with horizontal y values (specific values of a serie) for each abscisse x
|
||||
$serie[$i] = "var d".$i." = [];\n";
|
||||
$serie[$i] = "var d" . $i . " = [];\n";
|
||||
|
||||
// Fill array $values
|
||||
$x = 0;
|
||||
|
|
@ -712,14 +697,13 @@ class DolGraph
|
|||
$x++;
|
||||
}
|
||||
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar')))
|
||||
{
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar'))) {
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n";
|
||||
if (isset($y)) $serie[$i] .= 'd' . $i . '.push({"label":"' . dol_escape_js($legends[$x]) . '", "data":' . $y . '});' . "\n";
|
||||
}
|
||||
} else {
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) $serie[$i] .= 'd'.$i.'.push(['.$x.', '.$y.']);'."\n";
|
||||
if (isset($y)) $serie[$i] .= 'd' . $i . '.push([' . $x . ', ' . $y . ']);' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -728,43 +712,39 @@ class DolGraph
|
|||
}
|
||||
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
|
||||
|
||||
$this->stringtoshow = '<!-- Build using jflot -->'."\n";
|
||||
if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle'.(empty($this->cssprefix) ? '' : ' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
|
||||
if (!empty($this->shownographyet))
|
||||
{
|
||||
$this->stringtoshow .= '<div style="width:'.$this->width.'px;height:'.$this->height.'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow .= '<div class="nographyettext margintoponly">'.$langs->trans("NotEnoughDataYet").'...</div>';
|
||||
$this->stringtoshow = '<!-- Build using jflot -->' . "\n";
|
||||
if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>';
|
||||
if (!empty($this->shownographyet)) {
|
||||
$this->stringtoshow .= '<div style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow .= '<div class="nographyettext margintoponly">' . $langs->trans("NotEnoughDataYet") . '...</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
// Start the div that will contains all the graph
|
||||
$dolxaxisvertical = '';
|
||||
if (count($this->data) > 20) $dolxaxisvertical = 'dol-xaxis-vertical';
|
||||
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($dolxaxisvertical) ? '' : ' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"></div>'."\n";
|
||||
$this->stringtoshow .= '<div id="placeholder_' . $tag . '" style="width:' . $this->width . 'px;height:' . $this->height . 'px;" class="dolgraph' . (empty($dolxaxisvertical) ? '' : ' ' . $dolxaxisvertical) . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . ' center"></div>' . "\n";
|
||||
|
||||
$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
|
||||
$this->stringtoshow .= '$(function () {'."\n";
|
||||
$this->stringtoshow .= '<script id="' . $tag . '">' . "\n";
|
||||
$this->stringtoshow .= '$(function () {' . "\n";
|
||||
$i = $firstlot;
|
||||
if ($nblot < 0)
|
||||
{
|
||||
$this->stringtoshow .= '<!-- No series of data -->'."\n";
|
||||
if ($nblot < 0) {
|
||||
$this->stringtoshow .= '<!-- No series of data -->' . "\n";
|
||||
} else {
|
||||
while ($i < $nblot)
|
||||
{
|
||||
$this->stringtoshow .= '<!-- Serie '.$i.' -->'."\n";
|
||||
$this->stringtoshow .= $serie[$i]."\n";
|
||||
while ($i < $nblot) {
|
||||
$this->stringtoshow .= '<!-- Serie ' . $i . ' -->' . "\n";
|
||||
$this->stringtoshow .= $serie[$i] . "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$this->stringtoshow .= "\n";
|
||||
|
||||
// Special case for Graph of type 'pie'
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar')))
|
||||
{
|
||||
if (isset($this->type[$firstlot]) && in_array($this->type[$firstlot], array('pie', 'piesemicircle', 'polar'))) {
|
||||
$datacolor = array();
|
||||
foreach ($this->datacolor as $val) {
|
||||
if (is_array($val)) $datacolor[] = "#".sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); // If datacolor is array(R, G, B)
|
||||
else $datacolor[] = "#".str_replace(array('#', '-'), '', $val); // If $val is '124' or '#124'
|
||||
if (is_array($val)) $datacolor[] = "#" . sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); // If datacolor is array(R, G, B)
|
||||
else $datacolor[] = "#" . str_replace(array('#', '-'), '', $val); // If $val is '124' or '#124'
|
||||
}
|
||||
|
||||
$urltemp = ''; // TODO Add support for url link into labels
|
||||
|
|
@ -773,17 +753,17 @@ class DolGraph
|
|||
$showpercent = $this->showpercent;
|
||||
|
||||
$this->stringtoshow .= '
|
||||
function plotWithOptions_'.$tag.'() {
|
||||
$.plot($("#placeholder_'.$tag.'"), d0,
|
||||
function plotWithOptions_' . $tag . '() {
|
||||
$.plot($("#placeholder_' . $tag . '"), d0,
|
||||
{
|
||||
series: {
|
||||
pie: {
|
||||
show: true,
|
||||
radius: 0.8,
|
||||
'.($this->combine ? '
|
||||
' . ($this->combine ? '
|
||||
combine: {
|
||||
threshold: '.$this->combine.'
|
||||
},' : '').'
|
||||
threshold: ' . $this->combine . '
|
||||
},' : '') . '
|
||||
label: {
|
||||
show: true,
|
||||
radius: 0.9,
|
||||
|
|
@ -791,15 +771,15 @@ class DolGraph
|
|||
var percent=Math.round(series.percent);
|
||||
var number=series.data[0][1];
|
||||
return \'';
|
||||
$this->stringtoshow .= '<span style="font-size:8pt;text-align:center;padding:2px;color:black;">';
|
||||
if ($urltemp) $this->stringtoshow .= '<a style="color: #FFFFFF;" border="0" href="'.$urltemp.'">';
|
||||
$this->stringtoshow .= '\'+';
|
||||
$this->stringtoshow .= ($showlegend ? '' : 'label+\' \'+'); // Hide label if already shown in legend
|
||||
$this->stringtoshow .= ($showpointvalue ? 'number+' : '');
|
||||
$this->stringtoshow .= ($showpercent ? '\'<br/>\'+percent+\'%\'+' : '');
|
||||
$this->stringtoshow .= '\'';
|
||||
if ($urltemp) $this->stringtoshow .= '</a>';
|
||||
$this->stringtoshow .= '</span>\';
|
||||
$this->stringtoshow .= '<span style="font-size:8pt;text-align:center;padding:2px;color:black;">';
|
||||
if ($urltemp) $this->stringtoshow .= '<a style="color: #FFFFFF;" border="0" href="' . $urltemp . '">';
|
||||
$this->stringtoshow .= '\'+';
|
||||
$this->stringtoshow .= ($showlegend ? '' : 'label+\' \'+'); // Hide label if already shown in legend
|
||||
$this->stringtoshow .= ($showpointvalue ? 'number+' : '');
|
||||
$this->stringtoshow .= ($showpercent ? '\'<br/>\'+percent+\'%\'+' : '');
|
||||
$this->stringtoshow .= '\'';
|
||||
if ($urltemp) $this->stringtoshow .= '</a>';
|
||||
$this->stringtoshow .= '</span>\';
|
||||
},
|
||||
background: {
|
||||
opacity: 0.0,
|
||||
|
|
@ -814,21 +794,20 @@ class DolGraph
|
|||
pan: {
|
||||
interactive: true
|
||||
},';
|
||||
if (count($datacolor))
|
||||
{
|
||||
$this->stringtoshow .= 'colors: '.(!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)).',';
|
||||
if (count($datacolor)) {
|
||||
$this->stringtoshow .= 'colors: ' . (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor)) . ',';
|
||||
}
|
||||
$this->stringtoshow .= 'legend: {show: '.($showlegend ? 'true' : 'false').', position: \'ne\' }
|
||||
$this->stringtoshow .= 'legend: {show: ' . ($showlegend ? 'true' : 'false') . ', position: \'ne\' }
|
||||
});
|
||||
}'."\n";
|
||||
}' . "\n";
|
||||
}
|
||||
// Other cases, graph of type 'bars', 'lines'
|
||||
else {
|
||||
// Add code to support tooltips
|
||||
// TODO: remove js css and use graph-tooltip-inner class instead by adding css in each themes
|
||||
$this->stringtoshow .= '
|
||||
function showTooltip_'.$tag.'(x, y, contents) {
|
||||
$(\'<div class="graph-tooltip-inner" id="tooltip_'.$tag.'">\' + contents + \'</div>\').css({
|
||||
function showTooltip_' . $tag . '(x, y, contents) {
|
||||
$(\'<div class="graph-tooltip-inner" id="tooltip_' . $tag . '">\' + contents + \'</div>\').css({
|
||||
position: \'absolute\',
|
||||
display: \'none\',
|
||||
top: y + 10,
|
||||
|
|
@ -844,7 +823,7 @@ class DolGraph
|
|||
}
|
||||
|
||||
var previousPoint = null;
|
||||
$("#placeholder_'.$tag.'").bind("plothover", function (event, pos, item) {
|
||||
$("#placeholder_' . $tag . '").bind("plothover", function (event, pos, item) {
|
||||
$("#x").text(pos.x.toFixed(2));
|
||||
$("#y").text(pos.y.toFixed(2));
|
||||
|
||||
|
|
@ -858,27 +837,26 @@ class DolGraph
|
|||
var y = item.datapoint[1].toFixed(2);
|
||||
var z = item.series.xaxis.ticks[item.dataIndex].label;
|
||||
';
|
||||
if ($this->showpointvalue > 0) $this->stringtoshow .= '
|
||||
showTooltip_'.$tag.'(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y);
|
||||
if ($this->showpointvalue > 0) $this->stringtoshow .= '
|
||||
showTooltip_' . $tag . '(item.pageX, item.pageY, item.series.label + "<br>" + z + " => " + y);
|
||||
';
|
||||
$this->stringtoshow .= '
|
||||
$this->stringtoshow .= '
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#tooltip_'.$tag.'").remove();
|
||||
$("#tooltip_' . $tag . '").remove();
|
||||
previousPoint = null;
|
||||
}
|
||||
});
|
||||
';
|
||||
|
||||
$this->stringtoshow .= 'var stack = null, steps = false;'."\n";
|
||||
$this->stringtoshow .= 'var stack = null, steps = false;' . "\n";
|
||||
|
||||
$this->stringtoshow .= 'function plotWithOptions_'.$tag.'() {'."\n";
|
||||
$this->stringtoshow .= '$.plot($("#placeholder_'.$tag.'"), [ '."\n";
|
||||
$this->stringtoshow .= 'function plotWithOptions_' . $tag . '() {' . "\n";
|
||||
$this->stringtoshow .= '$.plot($("#placeholder_' . $tag . '"), [ ' . "\n";
|
||||
$i = $firstlot;
|
||||
while ($i < $nblot)
|
||||
{
|
||||
if ($i > $firstlot) $this->stringtoshow .= ', '."\n";
|
||||
while ($i < $nblot) {
|
||||
if ($i > $firstlot) $this->stringtoshow .= ', ' . "\n";
|
||||
$color = sprintf("%02x%02x%02x", $this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]);
|
||||
$this->stringtoshow .= '{ ';
|
||||
if (!isset($this->type[$i]) || $this->type[$i] == 'bars') {
|
||||
|
|
@ -886,42 +864,41 @@ class DolGraph
|
|||
if ($i == $firstlot) $align = 'right';
|
||||
elseif ($i == $firstlot + 1) $align = 'center';
|
||||
else $align = 'left';
|
||||
$this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "'.$align.'", barWidth: 0.45 }, ';
|
||||
} else $this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "'.($i == $firstlot ? 'center' : 'left').'", barWidth: 0.5 }, ';
|
||||
$this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "' . $align . '", barWidth: 0.45 }, ';
|
||||
} else $this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "' . ($i == $firstlot ? 'center' : 'left') . '", barWidth: 0.5 }, ';
|
||||
}
|
||||
if (isset($this->type[$i]) && ($this->type[$i] == 'lines' || $this->type[$i] == 'linesnopoint')) $this->stringtoshow .= 'lines: { show: true, fill: false }, points: { show: '.($this->type[$i] == 'linesnopoint' ? 'false' : 'true').' }, ';
|
||||
$this->stringtoshow .= 'color: "#'.$color.'", label: "'.(isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '').'", data: d'.$i.' }';
|
||||
if (isset($this->type[$i]) && ($this->type[$i] == 'lines' || $this->type[$i] == 'linesnopoint')) $this->stringtoshow .= 'lines: { show: true, fill: false }, points: { show: ' . ($this->type[$i] == 'linesnopoint' ? 'false' : 'true') . ' }, ';
|
||||
$this->stringtoshow .= 'color: "#' . $color . '", label: "' . (isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '') . '", data: d' . $i . ' }';
|
||||
$i++;
|
||||
}
|
||||
// shadowSize: 0 -> Drawing is faster without shadows
|
||||
$this->stringtoshow .= "\n".' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6, fillColor: { colors: [{opacity: 0.9 }, {opacity: 0.85}] }} }'."\n";
|
||||
$this->stringtoshow .= "\n" . ' ], { series: { shadowSize: 0, stack: stack, lines: { fill: false, steps: steps }, bars: { barWidth: 0.6, fillColor: { colors: [{opacity: 0.9 }, {opacity: 0.85}] }} }' . "\n";
|
||||
|
||||
// Xaxis
|
||||
$this->stringtoshow .= ', xaxis: { ticks: ['."\n";
|
||||
$this->stringtoshow .= ', xaxis: { ticks: [' . "\n";
|
||||
$x = 0;
|
||||
foreach ($this->data as $key => $valarray)
|
||||
{
|
||||
if ($x > 0) $this->stringtoshow .= ', '."\n";
|
||||
$this->stringtoshow .= ' ['.$x.', "'.$valarray[0].'"]';
|
||||
foreach ($this->data as $key => $valarray) {
|
||||
if ($x > 0) $this->stringtoshow .= ', ' . "\n";
|
||||
$this->stringtoshow .= ' [' . $x . ', "' . $valarray[0] . '"]';
|
||||
$x++;
|
||||
}
|
||||
$this->stringtoshow .= '] }'."\n";
|
||||
$this->stringtoshow .= '] }' . "\n";
|
||||
|
||||
// Yaxis
|
||||
$this->stringtoshow .= ', yaxis: { min: '.$this->MinValue.', max: '.($this->MaxValue).' }'."\n";
|
||||
$this->stringtoshow .= ', yaxis: { min: ' . $this->MinValue . ', max: ' . ($this->MaxValue) . ' }' . "\n";
|
||||
|
||||
// Background color
|
||||
$color1 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[0], $this->bgcolorgrid[2]);
|
||||
$color2 = sprintf("%02x%02x%02x", $this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]);
|
||||
$this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#'.$color1.'", "#'.$color2.'"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor : \'#e6e6e6\' }'."\n";
|
||||
$this->stringtoshow .= ', grid: { hoverable: true, backgroundColor: { colors: ["#' . $color1 . '", "#' . $color2 . '"] }, borderWidth: 1, borderColor: \'#e6e6e6\', tickColor : \'#e6e6e6\' }' . "\n";
|
||||
//$this->stringtoshow.=', shadowSize: 20'."\n"; TODO Uncommet this
|
||||
$this->stringtoshow .= '});'."\n";
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$this->stringtoshow .= '});' . "\n";
|
||||
$this->stringtoshow .= '}' . "\n";
|
||||
}
|
||||
|
||||
$this->stringtoshow .= 'plotWithOptions_'.$tag.'();'."\n";
|
||||
$this->stringtoshow .= '});'."\n";
|
||||
$this->stringtoshow .= '</script>'."\n";
|
||||
$this->stringtoshow .= 'plotWithOptions_' . $tag . '();' . "\n";
|
||||
$this->stringtoshow .= '});' . "\n";
|
||||
$this->stringtoshow .= '</script>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -947,10 +924,9 @@ class DolGraph
|
|||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::draw_chart this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
|
||||
dol_syslog(get_class($this) . "::draw_chart this->type=" . join(',', $this->type) . " this->MaxValue=" . $this->MaxValue);
|
||||
|
||||
if (empty($this->width) && empty($this->height))
|
||||
{
|
||||
if (empty($this->width) && empty($this->height)) {
|
||||
print 'Error width or height not set';
|
||||
return;
|
||||
}
|
||||
|
|
@ -971,7 +947,8 @@ class DolGraph
|
|||
// Works with line but not with bars
|
||||
//if ($nblot > 2) $firstlot = ($nblot - 2); // We limit nblot to 2 because jflot can't manage more than 2 bars on same x
|
||||
|
||||
$serie = array(); $arrayofgroupslegend = array();
|
||||
$serie = array();
|
||||
$arrayofgroupslegend = array();
|
||||
//var_dump($this->data);
|
||||
|
||||
$i = $firstlot;
|
||||
|
|
@ -989,15 +966,15 @@ class DolGraph
|
|||
$alabelexists = 1;
|
||||
$tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3);
|
||||
if (!empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
|
||||
$tmpvalue = (array_key_exists('y_'.$tmpykey[1].'_'.$tmpykey[2], $valarray) ? $valarray['y_'.$tmpykey[1].'_'.$tmpykey[2]] : $valarray[$i + 1]);
|
||||
$tmpvalue = (array_key_exists('y_' . $tmpykey[1] . '_' . $tmpykey[2], $valarray) ? $valarray['y_' . $tmpykey[1] . '_' . $tmpykey[2]] : $valarray[$i + 1]);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
$arrayofgroupslegend[$i] = array(
|
||||
'stacknum'=> $tmpykey[1],
|
||||
'stacknum' => $tmpykey[1],
|
||||
'legend' => $this->Legend[$tmpykey[1]],
|
||||
'legendwithgroup' => $this->Legend[$tmpykey[1]].' - '.$tmpykey[2]
|
||||
'legendwithgroup' => $this->Legend[$tmpykey[1]] . ' - ' . $tmpykey[2]
|
||||
);
|
||||
} else {
|
||||
$tmpvalue = (array_key_exists('y_'.$i, $valarray) ? $valarray['y_'.$i] : $valarray[$i + 1]);
|
||||
$tmpvalue = (array_key_exists('y_' . $i, $valarray) ? $valarray['y_' . $i] : $valarray[$i + 1]);
|
||||
//var_dump($i.'_'.$x.'_'.$tmpvalue);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
}
|
||||
|
|
@ -1007,9 +984,9 @@ class DolGraph
|
|||
$j = 0;
|
||||
foreach ($values as $x => $y) {
|
||||
if (isset($y)) {
|
||||
$serie[$i] .= ($j > 0 ? ", " : "").$y;
|
||||
$serie[$i] .= ($j > 0 ? ", " : "") . $y;
|
||||
} else {
|
||||
$serie[$i] .= ($j > 0 ? ", " : "").'null';
|
||||
$serie[$i] .= ($j > 0 ? ", " : "") . 'null';
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
|
@ -1022,12 +999,11 @@ class DolGraph
|
|||
|
||||
$tag = dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-', '.'))));
|
||||
|
||||
$this->stringtoshow = '<!-- Build using chart -->'."\n";
|
||||
if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle'.(empty($this->cssprefix) ? '' : ' dolgraphtitle'.$this->cssprefix).'">'.$this->title.'</div>';
|
||||
if (!empty($this->shownographyet))
|
||||
{
|
||||
$this->stringtoshow .= '<div style="width:'.$this->width.(strpos($this->width, '%') > 0 ? '' : 'px').'; height:'.$this->height.'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow .= '<div class="nographyettext margintoponly">'.$langs->trans("NotEnoughDataYet").'...</div>';
|
||||
$this->stringtoshow = '<!-- Build using chart -->' . "\n";
|
||||
if (!empty($this->title)) $this->stringtoshow .= '<div class="center dolgraphtitle' . (empty($this->cssprefix) ? '' : ' dolgraphtitle' . $this->cssprefix) . '">' . $this->title . '</div>';
|
||||
if (!empty($this->shownographyet)) {
|
||||
$this->stringtoshow .= '<div style="width:' . $this->width . (strpos($this->width, '%') > 0 ? '' : 'px') . '; height:' . $this->height . 'px;" class="nographyet"></div>';
|
||||
$this->stringtoshow .= '<div class="nographyettext margintoponly">' . $langs->trans("NotEnoughDataYet") . '...</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1036,17 +1012,15 @@ class DolGraph
|
|||
if (count($this->data) > 20) $dolxaxisvertical = 'dol-xaxis-vertical';
|
||||
// No height for the pie grah
|
||||
$cssfordiv = 'dolgraphchart';
|
||||
if (isset($this->type[$firstlot])) $cssfordiv .= ' dolgraphchar'.$this->type[$firstlot];
|
||||
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="min-height: '.$this->height.(strpos($this->height, '%') > 0 ? '' : 'px').'; width:'.$this->width.(strpos($this->width, '%') > 0 ? '' : 'px').';" class="'.$cssfordiv.' dolgraph'.(empty($dolxaxisvertical) ? '' : ' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"><canvas id="canvas_'.$tag.'"></canvas></div>'."\n";
|
||||
if (isset($this->type[$firstlot])) $cssfordiv .= ' dolgraphchar' . $this->type[$firstlot];
|
||||
$this->stringtoshow .= '<div id="placeholder_' . $tag . '" style="min-height: ' . $this->height . (strpos($this->height, '%') > 0 ? '' : 'px') . '; width:' . $this->width . (strpos($this->width, '%') > 0 ? '' : 'px') . ';" class="' . $cssfordiv . ' dolgraph' . (empty($dolxaxisvertical) ? '' : ' ' . $dolxaxisvertical) . (empty($this->cssprefix) ? '' : ' dolgraph' . $this->cssprefix) . ' center"><canvas id="canvas_' . $tag . '"></canvas></div>' . "\n";
|
||||
|
||||
$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
|
||||
$this->stringtoshow .= '<script id="' . $tag . '">' . "\n";
|
||||
$i = $firstlot;
|
||||
if ($nblot < 0)
|
||||
{
|
||||
if ($nblot < 0) {
|
||||
$this->stringtoshow .= '<!-- No series of data -->';
|
||||
} else {
|
||||
while ($i < $nblot)
|
||||
{
|
||||
while ($i < $nblot) {
|
||||
//$this->stringtoshow .= '<!-- Series '.$i.' -->'."\n";
|
||||
//$this->stringtoshow .= $serie[$i]."\n";
|
||||
$i++;
|
||||
|
|
@ -1055,69 +1029,69 @@ class DolGraph
|
|||
$this->stringtoshow .= "\n";
|
||||
|
||||
// Special case for Graph of type 'pie', 'piesemicircle', or 'polar'
|
||||
if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle'))))
|
||||
{
|
||||
if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle')))) {
|
||||
$type = $this->type[$firstlot]; // pie or polar
|
||||
$this->stringtoshow .= 'var options = {'."\n";
|
||||
$this->stringtoshow .= 'var options = {' . "\n";
|
||||
$legendMaxLines = 0; // Does not work
|
||||
if (empty($showlegend)) {
|
||||
$this->stringtoshow .= 'legend: { display: false }, ';
|
||||
} else {
|
||||
$this->stringtoshow .= 'legend: { position: \''.($showlegend == 2 ? 'right' : 'top').'\'';
|
||||
$this->stringtoshow .= 'legend: { position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\'';
|
||||
if (!empty($legendMaxLines)) {
|
||||
$this->stringtoshow .= ', maxLines: '.$legendMaxLines.'';
|
||||
$this->stringtoshow .= ', maxLines: ' . $legendMaxLines . '';
|
||||
}
|
||||
$this->stringtoshow .= ' }, '."\n";
|
||||
$this->stringtoshow .= ' }, ' . "\n";
|
||||
}
|
||||
|
||||
if ($this->type[$firstlot] == 'piesemicircle') {
|
||||
$this->stringtoshow .= 'circumference: Math.PI,'."\n";
|
||||
$this->stringtoshow .= 'rotation: -Math.PI,'."\n";
|
||||
$this->stringtoshow .= 'circumference: Math.PI,' . "\n";
|
||||
$this->stringtoshow .= 'rotation: -Math.PI,' . "\n";
|
||||
}
|
||||
$this->stringtoshow .= 'elements: { arc: {'."\n";
|
||||
$this->stringtoshow .= 'elements: { arc: {' . "\n";
|
||||
// Color of earch arc
|
||||
$this->stringtoshow .= 'backgroundColor: [';
|
||||
$i = 0; $foundnegativecolor = 0;
|
||||
$i = 0;
|
||||
$foundnegativecolor = 0;
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
if (is_array($this->datacolor[$i])) $color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')'; // If datacolor is array(R, G, B)
|
||||
if ($i > 0) $this->stringtoshow .= ', ' . "\n";
|
||||
if (is_array($this->datacolor[$i])) $color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ')'; // If datacolor is array(R, G, B)
|
||||
else {
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) {
|
||||
$foundnegativecolor++;
|
||||
$color = '#FFFFFF'; // If $val is '-123'
|
||||
} else $color = "#".$tmp; // If $val is '123' or '#123'
|
||||
} else $color = "#" . $tmp; // If $val is '123' or '#123'
|
||||
}
|
||||
$this->stringtoshow .= "'".$color."'";
|
||||
$this->stringtoshow .= "'" . $color . "'";
|
||||
$i++;
|
||||
}
|
||||
$this->stringtoshow .= '], '."\n";
|
||||
$this->stringtoshow .= '], ' . "\n";
|
||||
// Border color
|
||||
if ($foundnegativecolor) {
|
||||
$this->stringtoshow .= 'borderColor: [';
|
||||
$i = 0;
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
if ($i > 0) $this->stringtoshow .= ', ' . "\n";
|
||||
if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
|
||||
else {
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) $color = '#'.str_replace('-', '', $tmp); // If $val is '-123'
|
||||
if (strpos($tmp, '-') !== false) $color = '#' . str_replace('-', '', $tmp); // If $val is '-123'
|
||||
else $color = 'null'; // If $val is '123' or '#123'
|
||||
}
|
||||
$this->stringtoshow .= ($color == 'null' ? "'rgba(0,0,0,0.2)'" : "'".$color."'");
|
||||
$this->stringtoshow .= ($color == 'null' ? "'rgba(0,0,0,0.2)'" : "'" . $color . "'");
|
||||
$i++;
|
||||
}
|
||||
$this->stringtoshow .= ']';
|
||||
}
|
||||
$this->stringtoshow .= '} } };'."\n";
|
||||
$this->stringtoshow .= '} } };' . "\n";
|
||||
|
||||
$this->stringtoshow .= '
|
||||
var ctx = document.getElementById("canvas_'.$tag.'").getContext("2d");
|
||||
var ctx = document.getElementById("canvas_' . $tag . '").getContext("2d");
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: \''.(in_array($type, array('pie', 'piesemicircle')) ? 'doughnut' : 'polarArea').'\',
|
||||
type: \'' . (in_array($type, array('pie', 'piesemicircle')) ? 'doughnut' : 'polarArea') . '\',
|
||||
// Configuration options go here
|
||||
options: options,
|
||||
data: {
|
||||
|
|
@ -1127,7 +1101,7 @@ class DolGraph
|
|||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
|
||||
$this->stringtoshow .= "'" . dol_escape_js(dol_trunc($val, 32)) . "'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
|
@ -1137,24 +1111,28 @@ class DolGraph
|
|||
$i = 0;
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')';
|
||||
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ')';
|
||||
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
|
||||
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
$this->stringtoshow .= '{'."\n";
|
||||
if ($i > 0) $this->stringtoshow .= ', ' . "\n";
|
||||
$this->stringtoshow .= '{' . "\n";
|
||||
//$this->stringtoshow .= 'borderColor: \''.$color.'\', ';
|
||||
//$this->stringtoshow .= 'backgroundColor: \''.$color.'\', ';
|
||||
$this->stringtoshow .= ' data: ['.$serie[$i].']';
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$this->stringtoshow .= ' data: [' . $serie[$i] . ']';
|
||||
$this->stringtoshow .= '}' . "\n";
|
||||
$i++;
|
||||
}
|
||||
$this->stringtoshow .= ']'."\n";
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$this->stringtoshow .= '});'."\n";
|
||||
$this->stringtoshow .= ']' . "\n";
|
||||
$this->stringtoshow .= '}' . "\n";
|
||||
$this->stringtoshow .= '});' . "\n";
|
||||
}
|
||||
// Other cases, graph of type 'bars', 'lines', 'linesnopoint'
|
||||
else {
|
||||
$type = 'bar';
|
||||
|
||||
$isfunnel = false;
|
||||
if ($file == 'idgraphleadfunnel') $isfunnel = true;
|
||||
|
||||
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') $type = 'bar';
|
||||
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'horizontalbars') $type = 'horizontalBar';
|
||||
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line';
|
||||
|
|
@ -1164,6 +1142,9 @@ class DolGraph
|
|||
$this->stringtoshow .= 'legend: { display: false }, ';
|
||||
}
|
||||
$this->stringtoshow .= 'scales: { xAxes: [{ ';
|
||||
if ($isfunnel) { // FIXME Remove isfunnel by introducing a method hideXValues() on dolgraph
|
||||
$this->stringtoshow .= ' ticks: { display: false }, display: true,';
|
||||
}
|
||||
//$this->stringtoshow .= 'type: \'time\', '; // Need Moment.js
|
||||
$this->stringtoshow .= 'distribution: \'linear\'';
|
||||
if ($type == 'bar' && count($arrayofgroupslegend) > 0) {
|
||||
|
|
@ -1174,24 +1155,38 @@ class DolGraph
|
|||
$this->stringtoshow .= ', yAxes: [{ stacked: true }]';
|
||||
}
|
||||
$this->stringtoshow .= ' }';
|
||||
// Add a callback to change label to show only positive value
|
||||
if ($isfunnel) {
|
||||
$this->stringtoshow .= ', tooltips: { mode: \'nearest\',
|
||||
callbacks: {
|
||||
title: function(tooltipItem, data) {
|
||||
return data.datasets[tooltipItem[0].datasetIndex].label;
|
||||
},
|
||||
label: function(tooltipItem, data) {
|
||||
return data.datasets[tooltipItem.datasetIndex].data[0][1];
|
||||
}
|
||||
}
|
||||
},';
|
||||
}
|
||||
$this->stringtoshow .= '};';
|
||||
|
||||
$this->stringtoshow .= '
|
||||
var ctx = document.getElementById("canvas_'.$tag.'").getContext("2d");
|
||||
var ctx = document.getElementById("canvas_' . $tag . '").getContext("2d");
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: \''.$type.'\',
|
||||
type: \'' . $type . '\',
|
||||
// Configuration options go here
|
||||
options: options,
|
||||
data: {
|
||||
labels: [';
|
||||
|
||||
$i = 0;
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
|
||||
$i++;
|
||||
if (!$isfunnel) {
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".dol_escape_js(dol_trunc($val, 32))."'";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($arrayofgroupslegend);
|
||||
|
|
@ -1205,6 +1200,7 @@ class DolGraph
|
|||
$oldstacknum = -1;
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$foundnegativecolor = 0;
|
||||
$usecolorvariantforgroupby = 0;
|
||||
// We used a 'group by' and we have too many colors so we generated color variants per
|
||||
if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
|
||||
|
|
@ -1233,7 +1229,7 @@ class DolGraph
|
|||
$ratio = min(95, 10 + 10 * $iinstack); // step of 20
|
||||
$brightnessratio = min(90, 5 + 5 * $iinstack); // step of 10
|
||||
} else { // We decrease agressiveness of reference color for color 3, 5, 7, ..
|
||||
$ratio = max(-100, - 15 * $iinstack + 10); // step of -20
|
||||
$ratio = max(-100, -15 * $iinstack + 10); // step of -20
|
||||
$brightnessratio = min(90, 10 * $iinstack); // step of 20
|
||||
}
|
||||
//var_dump('Color '.($iinstack+1).' : '.$ratio.' '.$brightnessratio);
|
||||
|
|
@ -1242,37 +1238,72 @@ class DolGraph
|
|||
}
|
||||
$oldstacknum = $arrayofgroupslegend[$i]['stacknum'];
|
||||
|
||||
$color = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].', 0.9)';
|
||||
$bordercolor = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].')';
|
||||
} else { // We do not use a 'group by'
|
||||
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)';
|
||||
$bordercolor = $color;
|
||||
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
|
||||
$color = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ', 0.9)';
|
||||
$bordercolor = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ')';
|
||||
} else { // We do not use a 'group by'
|
||||
if ($isfunnel) {
|
||||
if (is_array($this->datacolor[$i])) {
|
||||
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)'; // If datacolor is array(R, G, B)
|
||||
} else {
|
||||
// TODO FIXME This logic must be in the caller that set $this->datacolor
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) {
|
||||
$foundnegativecolor++;
|
||||
$color = '#FFFFFF'; // If $val is '-123'
|
||||
} else {
|
||||
$color = "#" . $tmp; // If $val is '123' or '#123'
|
||||
$bordercolor = $color;
|
||||
}
|
||||
if ($foundnegativecolor) {
|
||||
if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
|
||||
else {
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) $bordercolor = '#' . str_replace('-', '', $tmp); // If $val is '-123'
|
||||
else $bordercolor = 'null'; // If $val is '123' or '#123'
|
||||
}
|
||||
$bordercolor == 'null' ? "'rgba(0,0,0,0.2)'" : "'" . $bordercolor . "'";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)';
|
||||
$bordercolor = $color;
|
||||
//$color = (!empty($data['seriescolor']) ? json_encode($data['seriescolor']) : json_encode($datacolor));
|
||||
}
|
||||
}
|
||||
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "\n";
|
||||
$this->stringtoshow .= '{';
|
||||
$this->stringtoshow .= 'dolibarrinfo: \'y_'.$i.'\', ';
|
||||
$this->stringtoshow .= 'label: \''.dol_escape_js(dol_string_nohtmltag($textoflegend)).'\', ';
|
||||
$this->stringtoshow .= 'pointStyle: \''.($this->type[$i] == 'linesnopoint' ? 'line' : 'circle').'\', ';
|
||||
$this->stringtoshow .= 'fill: '.($type == 'bar' ? 'true' : 'false').', ';
|
||||
if ($type == 'bar') { $this->stringtoshow .= 'borderWidth: \'1\', '; }
|
||||
$this->stringtoshow .= 'borderColor: \''.$bordercolor.'\', ';
|
||||
$this->stringtoshow .= 'backgroundColor: \''.$color.'\', ';
|
||||
if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \''.$arrayofgroupslegend[$i]['stacknum'].'\', ';
|
||||
$this->stringtoshow .= 'data: ['.$serie[$i].']';
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$this->stringtoshow .= 'dolibarrinfo: \'y_' . $i . '\', ';
|
||||
$this->stringtoshow .= 'label: \'' . dol_escape_js(dol_string_nohtmltag($textoflegend)) . '\', ';
|
||||
$this->stringtoshow .= 'pointStyle: \'' . ($this->type[$i] == 'linesnopoint' ? 'line' : 'circle') . '\', ';
|
||||
$this->stringtoshow .= 'fill: ' . ($type == 'bar' ? 'true' : 'false') . ', ';
|
||||
if ($isfunnel) {
|
||||
$this->stringtoshow .= 'borderWidth: \'2\', ';
|
||||
} elseif ($type == 'bar' || $type == 'horizontalBar') {
|
||||
$this->stringtoshow .= 'borderWidth: \'1\', ';
|
||||
}
|
||||
$this->stringtoshow .= 'borderColor: \'' . $bordercolor . '\', ';
|
||||
$this->stringtoshow .= 'backgroundColor: \'' . $color . '\', ';
|
||||
if ($arrayofgroupslegend[$i]) $this->stringtoshow .= 'stack: \'' . $arrayofgroupslegend[$i]['stacknum'] . '\', ';
|
||||
$this->stringtoshow .='data: [';
|
||||
if ($isfunnel) {
|
||||
$this->stringtoshow .= '['.-$serie[$i].','.$serie[$i].']';
|
||||
} else {
|
||||
$this->stringtoshow .= $serie[$i];
|
||||
}
|
||||
$this->stringtoshow .=']';
|
||||
$this->stringtoshow .= '}' . "\n";
|
||||
|
||||
$i++;
|
||||
$iinstack++;
|
||||
}
|
||||
$this->stringtoshow .= ']'."\n";
|
||||
$this->stringtoshow .= '}'."\n";
|
||||
$this->stringtoshow .= '});'."\n";
|
||||
$this->stringtoshow .= ']' . "\n";
|
||||
$this->stringtoshow .= '}' . "\n";
|
||||
$this->stringtoshow .= '});' . "\n";
|
||||
}
|
||||
|
||||
$this->stringtoshow .= '</script>'."\n";
|
||||
$this->stringtoshow .= '</script>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1301,14 +1332,13 @@ class DolGraph
|
|||
{
|
||||
global $langs;
|
||||
|
||||
if ($shownographyet)
|
||||
{
|
||||
$s = '<div class="nographyet" style="width:'.(preg_match('/%/', $this->width) ? $this->width : $this->width.'px').'; height:'.(preg_match('/%/', $this->height) ? $this->height : $this->height.'px').';"></div>';
|
||||
if ($shownographyet) {
|
||||
$s = '<div class="nographyet" style="width:' . (preg_match('/%/', $this->width) ? $this->width : $this->width . 'px') . '; height:' . (preg_match('/%/', $this->height) ? $this->height : $this->height . 'px') . ';"></div>';
|
||||
$s .= '<div class="nographyettext margintoponly">';
|
||||
if (is_numeric($shownographyet)) {
|
||||
$s .= $langs->trans("NotEnoughDataYet").'...';
|
||||
$s .= $langs->trans("NotEnoughDataYet") . '...';
|
||||
} else {
|
||||
$s .= $shownographyet.'...';
|
||||
$s .= $shownographyet . '...';
|
||||
}
|
||||
$s .= '</div>';
|
||||
return $s;
|
||||
|
|
|
|||
|
|
@ -1995,7 +1995,7 @@ class Form
|
|||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
|
||||
$urloption .= '&socid='.$socid;
|
||||
}
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
|
||||
|
||||
if (!empty($conf->variants->enabled)) {
|
||||
$out .= '
|
||||
|
|
@ -5930,24 +5930,29 @@ class Form
|
|||
*
|
||||
* @param string $prefix Prefix
|
||||
* @param string $selected Selected duration type
|
||||
* @param array|null $ecludetypes Array of duration types to exclude. Example array('y', 'm')
|
||||
* @param array $excludetypes Array of duration types to exclude. Example array('y', 'm')
|
||||
* @return string HTML select string
|
||||
*/
|
||||
public function selectTypeDuration($prefix, $selected = 'i', $excludtypes = null)
|
||||
public function selectTypeDuration($prefix, $selected = 'i', $excludetypes = array())
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes'));
|
||||
$TDurationTypes = array(
|
||||
'y'=>$langs->trans('Years'),
|
||||
'm'=>$langs->trans('Month'),
|
||||
'w'=>$langs->trans('Weeks'),
|
||||
'd'=>$langs->trans('Days'),
|
||||
'h'=>$langs->trans('Hours'),
|
||||
'i'=>$langs->trans('Minutes')
|
||||
);
|
||||
|
||||
// Removed undesired duration types
|
||||
if (is_array($excludtypes)) {
|
||||
foreach($excludtypes as $value) {
|
||||
unset($TDurationTypes[$value]);
|
||||
}
|
||||
foreach ($excludetypes as $value) {
|
||||
unset($TDurationTypes[$value]);
|
||||
}
|
||||
|
||||
$retstring = '<select class="flat" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
|
||||
foreach ($TDurationTypes as $key=>$typeduration) {
|
||||
foreach ($TDurationTypes as $key => $typeduration) {
|
||||
$retstring .= '<option value="'.$key.'"';
|
||||
if ($key == $selected) {
|
||||
$retstring .= " selected";
|
||||
|
|
@ -6192,6 +6197,7 @@ class Form
|
|||
$tmpfieldstoshow = '';
|
||||
foreach ($objecttmp->fields as $key => $val)
|
||||
{
|
||||
if (!dol_eval($val['enabled'], 1, 1)) continue;
|
||||
if ($val['showoncombobox']) $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
|
||||
}
|
||||
if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow;
|
||||
|
|
@ -6289,8 +6295,7 @@ class Form
|
|||
}
|
||||
if (empty($outputmode))
|
||||
{
|
||||
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid)
|
||||
{
|
||||
if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
|
||||
$out .= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
|
||||
} else {
|
||||
$out .= '<option value="'.$obj->rowid.'">'.$label.'</option>';
|
||||
|
|
@ -6767,7 +6772,7 @@ class Form
|
|||
{
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.$newval.'"';
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
|
|
|
|||
|
|
@ -1371,9 +1371,10 @@ class FormOther
|
|||
* @param mixed $object Object analyzed
|
||||
* @param array $search_groupby Array of preselected fields
|
||||
* @param array $arrayofgroupby Array of groupby to fill
|
||||
* @param string $morecss More CSS
|
||||
* @return string HTML string component
|
||||
*/
|
||||
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby)
|
||||
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby, $morecss = 'minwidth200 maxwidth250')
|
||||
{
|
||||
global $langs, $extrafields, $form;
|
||||
|
||||
|
|
@ -1395,9 +1396,9 @@ class FormOther
|
|||
if (preg_match('/^pass/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||
$arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y');
|
||||
$arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m');
|
||||
$arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d');
|
||||
$arrayofgroupby['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', 'position' => $val['position'].'-y');
|
||||
$arrayofgroupby['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', 'position' => $val['position'].'-m');
|
||||
$arrayofgroupby['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', 'position' => $val['position'].'-d');
|
||||
} else {
|
||||
$arrayofgroupby['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']);
|
||||
}
|
||||
|
|
@ -1417,7 +1418,7 @@ class FormOther
|
|||
foreach ($arrayofgroupby as $key => $val) {
|
||||
$arrayofgroupbylabel[$key] = $val['label'];
|
||||
}
|
||||
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1);
|
||||
$result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ if ($object->isextrafieldmanaged) {
|
|||
}
|
||||
}
|
||||
print '<div class="inline-block"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
|
||||
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth500', 1);
|
||||
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1);
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
* @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
|
||||
* @param string $urloption More parameters on URL request
|
||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @param int $autoselect Automatic selection if just one value (trigger("change") on field is done is search return only 1 result)
|
||||
* @param array $ajaxoptions Multiple options array
|
||||
* - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
||||
* - Ex: array('disabled'=> )
|
||||
|
|
|
|||
|
|
@ -931,8 +931,9 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
|
|||
// List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||
// Char '>' '<' '|' '$' and ';' are special chars for shells.
|
||||
// Char '/' and '\' are file delimiters.
|
||||
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';');
|
||||
return dol_string_nospecial($unaccent ?dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
|
||||
// -- car can be used into filename to inject special paramaters like --use-compress-program to make command with file as parameter making remote execution of command
|
||||
$filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';', '--');
|
||||
return dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -66,14 +66,15 @@ class pdf_proforma extends pdf_eratosthene
|
|||
* @param Commande $object Object to show
|
||||
* @param int $showaddress 0=no, 1=yes
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param Translate $outputlangsbis Object lang for output bis
|
||||
* @param string $titlekey Translation key to show as title of document
|
||||
* @return int Return topshift value
|
||||
*/
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null, $titlekey = "InvoiceProForma")
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $hookmanager;
|
||||
|
||||
return parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey);
|
||||
return parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $outputlangsbis, $titlekey);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,15 +152,16 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Get source company
|
||||
$this->emetteur = $mysoc;
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
|
||||
if (empty($this->emetteur->country_code)) {
|
||||
$this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined
|
||||
}
|
||||
|
||||
// Define position of columns
|
||||
$this->posxdesc = $this->marge_gauche + 1;
|
||||
$this->posxdiscount = 162;
|
||||
$this->postotalht = 174;
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$this->posxtva = 101;
|
||||
$this->posxup = 118;
|
||||
$this->posxqty = 135;
|
||||
|
|
@ -172,10 +173,11 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$this->posxunit = 162;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup = $this->posxtva;
|
||||
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || !empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) {
|
||||
$this->posxup = $this->posxtva;
|
||||
}
|
||||
$this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
$this->posxpicture -= 20;
|
||||
$this->posxtva -= 20;
|
||||
$this->posxup -= 20;
|
||||
|
|
@ -209,9 +211,13 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
// phpcs:enable
|
||||
global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblines;
|
||||
|
||||
if (!is_object($outputlangs)) $outputlangs = $langs;
|
||||
if (!is_object($outputlangs)) {
|
||||
$outputlangs = $langs;
|
||||
}
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1';
|
||||
if (!empty($conf->global->MAIN_USE_FPDF)) {
|
||||
$outputlangs->charset_output = 'ISO-8859-1';
|
||||
}
|
||||
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal"));
|
||||
|
|
@ -220,17 +226,16 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray = array();
|
||||
if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE))
|
||||
{
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
if (empty($object->lines[$i]->fk_product)) continue;
|
||||
if (!empty($conf->global->MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE)) {
|
||||
for ($i = 0; $i < $nblines; $i++) {
|
||||
if (empty($object->lines[$i]->fk_product)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$objphoto = new Product($this->db);
|
||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
||||
|
||||
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
|
||||
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/";
|
||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||
} else {
|
||||
|
|
@ -239,28 +244,29 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
|
||||
$realpath = '';
|
||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj)
|
||||
{
|
||||
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
|
||||
$filename = $obj['photo'];
|
||||
//if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette'];
|
||||
$realpath = $dir.$filename;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($realpath) $realpatharray[$i] = $realpath;
|
||||
if ($realpath) {
|
||||
$realpatharray[$i] = $realpath;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($realpatharray) == 0) $this->posxpicture = $this->posxtva;
|
||||
if (count($realpatharray) == 0) {
|
||||
$this->posxpicture = $this->posxtva;
|
||||
}
|
||||
|
||||
if ($conf->supplier_proposal->dir_output)
|
||||
{
|
||||
if ($conf->supplier_proposal->dir_output) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// $deja_regle = 0;
|
||||
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
if ($object->specimen) {
|
||||
$dir = $conf->supplier_proposal->dir_output;
|
||||
$file = $dir."/SPECIMEN.pdf";
|
||||
} else {
|
||||
|
|
@ -269,20 +275,16 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$file = $dir."/".$objectref.".pdf";
|
||||
}
|
||||
|
||||
if (!file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
{
|
||||
if (!file_exists($dir)) {
|
||||
if (dol_mkdir($dir) < 0) {
|
||||
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (file_exists($dir)) {
|
||||
// Add pdfgeneration hook
|
||||
if (!is_object($hookmanager))
|
||||
{
|
||||
if (!is_object($hookmanager)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
|
|
@ -297,18 +299,18 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$heightforinfotot = 50; // Height reserved to output the info and total part
|
||||
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;
|
||||
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) {
|
||||
$heightforfooter += 6;
|
||||
}
|
||||
$pdf->SetAutoPageBreak(1, 0);
|
||||
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
if (class_exists('TCPDF')) {
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
// Set path to the background PDF File
|
||||
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
|
||||
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
|
||||
$tplidx = $pdf->importPage(1);
|
||||
}
|
||||
|
|
@ -322,20 +324,19 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
|
||||
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialAsk")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
|
||||
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
|
||||
$pdf->SetCompression(false);
|
||||
}
|
||||
|
||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
||||
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
for ($i = 0; $i < $nblines; $i++) {
|
||||
if ($object->lines[$i]->remise_percent) {
|
||||
$this->atleastonediscount++;
|
||||
}
|
||||
}
|
||||
if (empty($this->atleastonediscount))
|
||||
{
|
||||
if (empty($this->atleastonediscount)) {
|
||||
$delta = ($this->postotalht - $this->posxdiscount);
|
||||
$this->posxpicture += $delta;
|
||||
$this->posxtva += $delta;
|
||||
|
|
@ -348,7 +349,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
$pagenb++;
|
||||
$top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
|
|
@ -360,19 +363,18 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Affiche notes
|
||||
$notetoshow = empty($object->note_public) ? '' : $object->note_public;
|
||||
if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) {
|
||||
// Get first sale rep
|
||||
if (is_object($object->thirdparty))
|
||||
{
|
||||
if (is_object($object->thirdparty)) {
|
||||
$salereparray = $object->thirdparty->getSalesRepresentatives($user);
|
||||
$salerepobj = new User($this->db);
|
||||
$salerepobj->fetch($salereparray[0]['id']);
|
||||
if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
|
||||
if (!empty($salerepobj->signature)) {
|
||||
$notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($notetoshow)
|
||||
{
|
||||
if ($notetoshow) {
|
||||
$tab_top -= 2;
|
||||
|
||||
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
|
||||
|
|
@ -397,15 +399,16 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$nexY = $tab_top + 7;
|
||||
|
||||
// Loop on each lines
|
||||
for ($i = 0; $i < $nblines; $i++)
|
||||
{
|
||||
for ($i = 0; $i < $nblines; $i++) {
|
||||
$curY = $nexY;
|
||||
$pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
// Define size of image if we need it
|
||||
$imglinesize = array();
|
||||
if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]);
|
||||
if (!empty($realpatharray[$i])) {
|
||||
$imglinesize = pdf_getSizeForImage($realpatharray[$i]);
|
||||
}
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
|
|
@ -416,23 +419,27 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$posYAfterDescription = 0;
|
||||
|
||||
// We start with Photo of product line
|
||||
if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // If photo too high, we moved completely on new page
|
||||
{
|
||||
if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page
|
||||
$pdf->AddPage('', '', true);
|
||||
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
$pdf->setPage($pageposbefore + 1);
|
||||
|
||||
$curY = $tab_top_newpage;
|
||||
|
||||
// Allows data in the first page if description is long enough to break in multiples pages
|
||||
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
|
||||
$showpricebeforepagebreak = 1;
|
||||
else $showpricebeforepagebreak = 0;
|
||||
} else {
|
||||
$showpricebeforepagebreak = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($imglinesize['width']) && !empty($imglinesize['height']))
|
||||
{
|
||||
if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) {
|
||||
$curX = $this->posxpicture - 1;
|
||||
$pdf->Image($realpatharray[$i], $curX + (($this->posxtva - $this->posxpicture - $imglinesize['width']) / 2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
|
||||
// $pdf->Image does not increase value return by getY, so we save it manually
|
||||
|
|
@ -443,8 +450,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$curX = $this->posxdesc - 1;
|
||||
|
||||
$pdf->startTransaction();
|
||||
if ($posYAfterImage > 0)
|
||||
{
|
||||
if ($posYAfterImage > 0) {
|
||||
$descWidth = $this->posxpicture - $curX;
|
||||
} else {
|
||||
$descWidth = $this->posxtva - $curX;
|
||||
|
|
@ -452,8 +458,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
if ($pageposafter > $pageposbefore) { // There is a pagebreak
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
|
|
@ -463,21 +468,25 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
|
||||
{
|
||||
if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page
|
||||
{
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text
|
||||
if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page
|
||||
$pdf->AddPage('', '', true);
|
||||
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
$pdf->setPage($pageposafter + 1);
|
||||
}
|
||||
} else {
|
||||
// We found a page break
|
||||
// Allows data in the first page if description is long enough to break in multiples pages
|
||||
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE))
|
||||
if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) {
|
||||
$showpricebeforepagebreak = 1;
|
||||
else $showpricebeforepagebreak = 0;
|
||||
} else {
|
||||
$showpricebeforepagebreak = 0;
|
||||
}
|
||||
}
|
||||
} else // No pagebreak
|
||||
{
|
||||
|
|
@ -513,7 +522,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetXY($this->posxup, $curY);
|
||||
if ($up_excl_tax > 0)
|
||||
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0);
|
||||
*/
|
||||
*/
|
||||
|
||||
// Quantity
|
||||
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
|
|
@ -521,8 +530,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->MultiCell($this->posxunit - $this->posxqty - 0.8, 4, $qty, 0, 'R'); // Enough for 6 chars
|
||||
|
||||
// Unit
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS))
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager);
|
||||
$pdf->SetXY($this->posxunit, $curY);
|
||||
$pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 4, $unit, 0, 'L');
|
||||
|
|
@ -542,11 +550,14 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetXY($this->postotalht, $curY);
|
||||
if ($total_excl_tax > 0)
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
|
||||
*/
|
||||
*/
|
||||
|
||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||
if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva;
|
||||
else $tvaligne = $object->lines[$i]->total_tva;
|
||||
if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) {
|
||||
$tvaligne = $object->lines[$i]->multicurrency_total_tva;
|
||||
} else {
|
||||
$tvaligne = $object->lines[$i]->total_tva;
|
||||
}
|
||||
|
||||
$localtax1ligne = $object->lines[$i]->total_localtax1;
|
||||
$localtax2ligne = $object->lines[$i]->total_localtax2;
|
||||
|
|
@ -555,36 +566,48 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$localtax1_type = $object->lines[$i]->localtax1_type;
|
||||
$localtax2_type = $object->lines[$i]->localtax2_type;
|
||||
|
||||
if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
|
||||
if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
|
||||
if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
|
||||
if ($object->remise_percent) {
|
||||
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
|
||||
}
|
||||
if ($object->remise_percent) {
|
||||
$localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
|
||||
}
|
||||
if ($object->remise_percent) {
|
||||
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
|
||||
}
|
||||
|
||||
$vatrate = (string) $object->lines[$i]->tva_tx;
|
||||
|
||||
// Retrieve type from database for backward compatibility with old records
|
||||
if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
|
||||
&& (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax
|
||||
{
|
||||
&& (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
|
||||
$localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
|
||||
$localtax1_type = $localtaxtmp_array[0];
|
||||
$localtax2_type = $localtaxtmp_array[2];
|
||||
}
|
||||
|
||||
// retrieve global local tax
|
||||
if ($localtax1_type && $localtax1ligne != 0)
|
||||
if ($localtax1_type && $localtax1ligne != 0) {
|
||||
$this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne;
|
||||
if ($localtax2_type && $localtax2ligne != 0)
|
||||
}
|
||||
if ($localtax2_type && $localtax2ligne != 0) {
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne;
|
||||
}
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*';
|
||||
if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = 0;
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
|
||||
$vatrate .= '*';
|
||||
}
|
||||
if (!isset($this->tva[$vatrate])) {
|
||||
$this->tva[$vatrate] = 0;
|
||||
}
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) $nexY = $posYAfterImage;
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
}
|
||||
|
||||
// Add line
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) {
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
|
|
@ -595,11 +618,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$nexY += 2; // Add space between lines
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
while ($pagenb < $pageposafter)
|
||||
{
|
||||
while ($pagenb < $pageposafter) {
|
||||
$pdf->setPage($pagenb);
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
|
||||
|
|
@ -608,12 +629,12 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pagenb++;
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak)
|
||||
{
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) {
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
|
||||
} else {
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
|
||||
|
|
@ -621,15 +642,18 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$this->_pagefoot($pdf, $object, $outputlangs, 1);
|
||||
// New page
|
||||
$pdf->AddPage();
|
||||
if (!empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (!empty($tplidx)) {
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
$pagenb++;
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
|
||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
if ($pagenb == 1) {
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
||||
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
} else {
|
||||
|
|
@ -653,7 +677,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf, $object, $outputlangs);
|
||||
if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages();
|
||||
if (method_exists($pdf, 'AliasNbPages')) {
|
||||
$pdf->AliasNbPages();
|
||||
}
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
|
|
@ -664,14 +690,14 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0)
|
||||
{
|
||||
if ($reshook < 0) {
|
||||
$this->error = $hookmanager->error;
|
||||
$this->errors = $hookmanager->errors;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
if (!empty($conf->global->MAIN_UMASK)) {
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
|
@ -724,8 +750,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$posxval = 52;
|
||||
|
||||
// Show shipping date
|
||||
if (!empty($object->delivery_date))
|
||||
{
|
||||
if (!empty($object->delivery_date)) {
|
||||
$outputlangs->load("sendings");
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
|
@ -768,8 +793,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}*/
|
||||
|
||||
// Show payments conditions
|
||||
if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement))
|
||||
{
|
||||
if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").':';
|
||||
|
|
@ -784,13 +808,11 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$posy = $pdf->GetY() + 3;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE))
|
||||
{
|
||||
if (!empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMMODE)) {
|
||||
// Show payment mode
|
||||
if ($object->mode_reglement_code
|
||||
&& $object->mode_reglement_code != 'CHQ'
|
||||
&& $object->mode_reglement_code != 'VIR')
|
||||
{
|
||||
&& $object->mode_reglement_code != 'VIR') {
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy - 2);
|
||||
$titre = $outputlangs->transnoentities("PaymentMode").':';
|
||||
|
|
@ -804,15 +826,12 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
|
||||
// Show payment mode CHQ
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ')
|
||||
{
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
|
||||
// Si mode reglement non force ou si force a CHQ
|
||||
if (!empty($conf->global->FACTURE_CHQ_NUMBER))
|
||||
{
|
||||
if (!empty($conf->global->FACTURE_CHQ_NUMBER)) {
|
||||
$diffsizetitle = (empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE);
|
||||
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0)
|
||||
{
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER > 0) {
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($conf->global->FACTURE_CHQ_NUMBER);
|
||||
|
||||
|
|
@ -821,23 +840,20 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
|
||||
{
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 2;
|
||||
}
|
||||
}
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER == -1)
|
||||
{
|
||||
if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 1;
|
||||
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS))
|
||||
{
|
||||
if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) {
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0);
|
||||
|
|
@ -848,10 +864,8 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
|
||||
// If payment mode not forced or forced to VIR, show payment with BAN
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
|
||||
{
|
||||
if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER))
|
||||
{
|
||||
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') {
|
||||
if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) {
|
||||
$bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank);
|
||||
$account = new Account($this->db);
|
||||
$account->fetch($bankid);
|
||||
|
|
@ -893,8 +907,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Tableau total
|
||||
$col1x = 120; $col2x = 170;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
$col2x -= 20;
|
||||
}
|
||||
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
|
||||
|
|
@ -914,32 +927,28 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetFillColor(248, 248, 248);
|
||||
|
||||
$this->atleastoneratenotnull = 0;
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||
{
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
|
||||
$tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
|
||||
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull)
|
||||
{
|
||||
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_IFNULL) && $tvaisnull) {
|
||||
// Nothing to do
|
||||
} else {
|
||||
//Local tax 1 before VAT
|
||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
||||
//{
|
||||
foreach ($this->localtax1 as $localtax_type => $localtax_rate)
|
||||
{
|
||||
if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
|
||||
foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
|
||||
if (in_array((string) $localtax_type, array('1', '3', '5'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
foreach ($localtax_rate as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl = '';
|
||||
if (preg_match('/\*/', $tvakey))
|
||||
{
|
||||
if (preg_match('/\*/', $tvakey)) {
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
|
|
@ -952,18 +961,17 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
//Local tax 2 before VAT
|
||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
||||
//{
|
||||
foreach ($this->localtax2 as $localtax_type => $localtax_rate)
|
||||
{
|
||||
if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
|
||||
foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
|
||||
if (in_array((string) $localtax_type, array('1', '3', '5'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
foreach ($localtax_rate as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
|
||||
|
|
@ -972,8 +980,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl = '';
|
||||
if (preg_match('/\*/', $tvakey))
|
||||
{
|
||||
if (preg_match('/\*/', $tvakey)) {
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
|
|
@ -988,18 +995,15 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
//}
|
||||
// VAT
|
||||
foreach ($this->tva as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey > 0) // On affiche pas taux 0
|
||||
{
|
||||
foreach ($this->tva as $tvakey => $tvaval) {
|
||||
if ($tvakey > 0) { // On affiche pas taux 0
|
||||
$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl = '';
|
||||
if (preg_match('/\*/', $tvakey))
|
||||
{
|
||||
if (preg_match('/\*/', $tvakey)) {
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
|
|
@ -1015,22 +1019,20 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
//Local tax 1 after VAT
|
||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on')
|
||||
//{
|
||||
foreach ($this->localtax1 as $localtax_type => $localtax_rate)
|
||||
{
|
||||
if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
|
||||
foreach ($this->localtax1 as $localtax_type => $localtax_rate) {
|
||||
if (in_array((string) $localtax_type, array('2', '4', '6'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
foreach ($localtax_rate as $tvakey => $tvaval) {
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl = '';
|
||||
if (preg_match('/\*/', $tvakey))
|
||||
{
|
||||
if (preg_match('/\*/', $tvakey)) {
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
|
|
@ -1043,27 +1045,25 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
//Local tax 2 after VAT
|
||||
//if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on')
|
||||
//{
|
||||
foreach ($this->localtax2 as $localtax_type => $localtax_rate)
|
||||
{
|
||||
if (in_array((string) $localtax_type, array('2', '4', '6'))) continue;
|
||||
foreach ($this->localtax2 as $localtax_type => $localtax_rate) {
|
||||
if (in_array((string) $localtax_type, array('2', '4', '6'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($localtax_rate as $tvakey => $tvaval)
|
||||
{
|
||||
foreach ($localtax_rate as $tvakey => $tvaval) {
|
||||
// retrieve global local tax
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
{
|
||||
if ($tvakey != 0) { // On affiche pas taux 0
|
||||
//$this->atleastoneratenotnull++;
|
||||
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
|
||||
$tvacompl = '';
|
||||
if (preg_match('/\*/', $tvakey))
|
||||
{
|
||||
if (preg_match('/\*/', $tvakey)) {
|
||||
$tvakey = str_replace('*', '', $tvakey);
|
||||
$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
|
||||
}
|
||||
|
|
@ -1094,7 +1094,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
||||
$resteapayer = $object->total_ttc - $deja_regle;
|
||||
if (!empty($object->paye)) $resteapayer = 0;
|
||||
if (!empty($object->paye)) {
|
||||
$resteapayer = 0;
|
||||
}
|
||||
|
||||
if ($deja_regle > 0) {
|
||||
$index++;
|
||||
|
|
@ -1158,7 +1160,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Force to disable hidetop and hidebottom
|
||||
$hidebottom = 0;
|
||||
if ($hidetop) $hidetop = -1;
|
||||
if ($hidetop) {
|
||||
$hidetop = -1;
|
||||
}
|
||||
|
||||
$currency = !empty($currency) ? $currency : $conf->currency;
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
|
@ -1167,14 +1171,15 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetTextColor(0, 0, 0);
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
|
||||
$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
|
||||
|
||||
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
|
||||
if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||
if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
|
||||
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128, 128, 128);
|
||||
|
|
@ -1183,35 +1188,30 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
// Output Rect
|
||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect takes a length in 3rd parameter and 4th parameter
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line takes a position y in 2nd parameter and 4th parameter
|
||||
|
||||
$pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
|
||||
$pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||
{
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
|
||||
$pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height);
|
||||
//$pdf->line($this->posxtva-2, $tab_top, $this->posxtva-2, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxtva - 5, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->line($this->posxup - 3, $tab_top, $this->posxup - 3, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxup - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
|
||||
}
|
||||
|
||||
$pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxqty - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
|
||||
}
|
||||
|
|
@ -1225,20 +1225,16 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
|
||||
$pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if ($this->atleastonediscount)
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
if ($this->atleastonediscount) {
|
||||
$pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
|
||||
$pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
|
||||
}
|
||||
}
|
||||
if ($this->atleastonediscount)
|
||||
{
|
||||
if ($this->atleastonediscount) {
|
||||
$pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
|
||||
}
|
||||
if (empty($hidetop))
|
||||
{
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->postotalht - 1, $tab_top + 1);
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
|
||||
}
|
||||
|
|
@ -1266,8 +1262,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
||||
|
||||
// Show Draft Watermark
|
||||
if ($object->statut == 0 && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK)))
|
||||
{
|
||||
if ($object->statut == 0 && (!empty($conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK))) {
|
||||
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK);
|
||||
}
|
||||
|
||||
|
|
@ -1281,10 +1276,8 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
if ($this->emetteur->logo) {
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
} else {
|
||||
|
|
@ -1314,8 +1307,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$posy += 1;
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
|
||||
if ($object->ref_client)
|
||||
{
|
||||
if ($object->ref_client) {
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
|
|
@ -1326,10 +1318,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R');
|
||||
*/
|
||||
*/
|
||||
|
||||
if ($object->thirdparty->code_fournisseur)
|
||||
{
|
||||
if ($object->thirdparty->code_fournisseur) {
|
||||
$posy += 4;
|
||||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
|
|
@ -1337,11 +1328,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
}
|
||||
|
||||
// Get contact
|
||||
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP))
|
||||
{
|
||||
if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) {
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$usertmp = new User($this->db);
|
||||
$usertmp->fetch($arrayidcontact[0]);
|
||||
$posy += 4;
|
||||
|
|
@ -1357,30 +1346,29 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
// Show list of linked objects
|
||||
$current_y = $pdf->getY();
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||
if ($current_y < $pdf->getY())
|
||||
{
|
||||
if ($current_y < $pdf->getY()) {
|
||||
$top_shift = $pdf->getY() - $current_y;
|
||||
}
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
if ($showaddress) {
|
||||
// Sender properties
|
||||
$carac_emetteur = '';
|
||||
// Add internal contact of proposal if defined
|
||||
// Add internal contact of proposal if defined
|
||||
$arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$object->fetch_user($arrayidcontact[0]);
|
||||
$labelbeforecontactname = ($outputlangs->transnoentities("FromContactName") != 'FromContactName' ? $outputlangs->transnoentities("FromContactName") : $outputlangs->transnoentities("Name"));
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '').$labelbeforecontactname.": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object);
|
||||
|
||||
// Show sender
|
||||
$posy = 42 + $top_shift;
|
||||
$posx = $this->marge_gauche;
|
||||
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80;
|
||||
$posx = $this->marge_gauche;
|
||||
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
|
||||
$posx = $this->page_largeur - $this->marge_droite - 80;
|
||||
}
|
||||
$hautcadre = 40;
|
||||
|
||||
// Show sender frame
|
||||
|
|
@ -1408,22 +1396,20 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
// If CUSTOMER contact defined, we use it
|
||||
$usecontact = false;
|
||||
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
|
||||
if (count($arrayidcontact) > 0)
|
||||
{
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$usecontact = true;
|
||||
$result = $object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if (!empty($usecontact))
|
||||
{
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socname = $object->contact->socname;
|
||||
$socname = $object->contact;
|
||||
} else {
|
||||
$socname = $object->thirdparty->name;
|
||||
$socname = $object->thirdparty;
|
||||
}
|
||||
} else {
|
||||
$socname = $object->thirdparty->name;
|
||||
$socname = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name = pdfBuildThirdpartyName($socname, $outputlangs);
|
||||
|
|
@ -1432,10 +1418,14 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
|
||||
// Show recipient
|
||||
$widthrecbox = 100;
|
||||
if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format
|
||||
if ($this->page_largeur < 210) {
|
||||
$widthrecbox = 84; // To work with US executive format
|
||||
}
|
||||
$posy = 42 + $top_shift;
|
||||
$posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
|
||||
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche;
|
||||
if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
|
||||
$posx = $this->marge_gauche;
|
||||
}
|
||||
|
||||
// Show recipient frame
|
||||
$pdf->SetTextColor(0, 0, 0);
|
||||
|
|
|
|||
|
|
@ -546,10 +546,10 @@ CREATE TABLE llx_session(
|
|||
)ENGINE=innodb;
|
||||
|
||||
|
||||
|
||||
INSERT INTO llx_boxes_def(file,entity) VALUES ('box_funnel_of_prospection.php',1);
|
||||
|
||||
INSERT INTO llx_boxes_def(file, entity) VALUES ('box_customers_outstanding_bill_reached.php', 1);
|
||||
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_funnel_of_prospection.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_funnel_of_prospection.php' AND entity = 1);
|
||||
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
|
||||
--INSERT INTO llx_boxes_def(file, entity) VALUES ('box_funnel_of_prospection.php',1);
|
||||
--INSERT INTO llx_boxes_def(file, entity) VALUES ('box_customers_outstanding_bill_reached.php', 1);
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);
|
||||
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ ExamplesWithCurrentSetup=Examples with current configuration
|
|||
ListOfDirectories=List of OpenDocument templates directories
|
||||
ListOfDirectoriesForModelGenODT=List of directories containing templates files with OpenDocument format.<br><br>Put here full path of directories.<br>Add a carriage return between eah directory.<br>To add a directory of the GED module, add here <b>DOL_DATA_ROOT/ecm/yourdirectoryname</b>.<br><br>Files in those directories must end with <b>.odt</b> or <b>.ods</b>.
|
||||
NumberOfModelFilesFound=Number of ODT/ODS template files found in these directories
|
||||
ExampleOfDirectoriesForModelGen=Examples of syntax:<br>c:\\mydir<br>/home/mydir<br>DOL_DATA_ROOT/ecm/ecmdir
|
||||
ExampleOfDirectoriesForModelGen=Examples of syntax:<br>c:\\myapp\\mydocumentdir\\mysubdir<br>/home/myapp/mydocumentdir/mysubdir<br>DOL_DATA_ROOT/ecm/ecmdir
|
||||
FollowingSubstitutionKeysCanBeUsed=<br>To know how to create your odt document templates, before storing them in those directories, read wiki documentation:
|
||||
FullListOnOnlineDocumentation=http://wiki.dolibarr.org/index.php/Create_an_ODT_document_template
|
||||
FirstnameNamePosition=Position of Name/Lastname
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ BoxTitleLastOutstandingBillReached=Customers with maximum outstanding exceeded
|
|||
BoxGlobalActivity=Global activity (invoices, proposals, orders)
|
||||
BoxGoodCustomers=Good customers
|
||||
BoxTitleGoodCustomers=%s Good customers
|
||||
BoxTitleFunnelOfProspection=Amount of prospection by status
|
||||
BoxScheduledJobs=Scheduled jobs
|
||||
BoxTitleFunnelOfProspection=Lead funnel
|
||||
FailedToRefreshDataInfoNotUpToDate=Failed to refresh RSS flux. Latest successful refresh date: %s
|
||||
LastRefreshDate=Latest refresh date
|
||||
NoRecordedBookmarks=No bookmarks defined.
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ $action = GETPOST('action', 'aZ09');
|
|||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
|
||||
$arrayofparameters = array(
|
||||
'MYMODULE_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
|
|
@ -130,47 +133,52 @@ if ($action == 'updateMask')
|
|||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
elseif ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
} elseif ($action == 'del')
|
||||
{
|
||||
elseif ($action == 'setmod') {
|
||||
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
elseif ($action == 'setdoc')
|
||||
{
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity))
|
||||
{
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->$constforval = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
// Activate a model
|
||||
elseif ($action == 'set') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
} elseif ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
if ($ret > 0) {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'setmod')
|
||||
{
|
||||
// TODO Check if numbering module chosen can be activated
|
||||
// by calling method canBeActivated
|
||||
}
|
||||
|
||||
// Set or unset default model
|
||||
elseif ($action == 'setdoc') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->$constforval = $value;
|
||||
}
|
||||
|
||||
// We disable/enable the document template (into llx_document_model table)
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'MYMODULE_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -459,18 +467,19 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
|||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name)
|
||||
{
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -1028,7 +1028,7 @@ class MyObject extends CommonObject
|
|||
if (!dol_strlen($modele)) {
|
||||
$modele = 'standard_myobject';
|
||||
|
||||
if ($this->model_pdf) {
|
||||
if (!empty($this->model_pdf)) {
|
||||
$modele = $this->model_pdf;
|
||||
} elseif (!empty($conf->global->MYOBJECT_ADDON_PDF)) {
|
||||
$modele = $conf->global->MYOBJECT_ADDON_PDF;
|
||||
|
|
@ -1037,7 +1037,7 @@ class MyObject extends CommonObject
|
|||
|
||||
$modelpath = "core/modules/mymodule/doc/";
|
||||
|
||||
if ($includedocgeneration) {
|
||||
if ($includedocgeneration && !empty($modele)) {
|
||||
$result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -413,6 +413,7 @@ class Product extends CommonObject
|
|||
public $fields = array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'visible'=>-1, 'showoncombobox'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1),
|
||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ $action = GETPOST('action', 'aZ09');
|
|||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'recruitmentjobposition';
|
||||
|
||||
$arrayofparameters = array(
|
||||
// 'RECRUITMENT_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
|
|
@ -131,47 +134,52 @@ if ($action == 'updateMask')
|
|||
}
|
||||
|
||||
// Activate a model
|
||||
elseif ($action == 'set')
|
||||
{
|
||||
elseif ($action == 'set') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
} elseif ($action == 'del')
|
||||
{
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
|
||||
} elseif ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
if ($ret > 0) {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setmod') {
|
||||
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
elseif ($action == 'setdoc')
|
||||
{
|
||||
elseif ($action == 'setdoc') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity))
|
||||
{
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->$constforval = $value;
|
||||
}
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->$constforval = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
// We disable/enable the document template (into llx_document_model table)
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'setmod')
|
||||
{
|
||||
// TODO Check if numbering module chosen can be activated
|
||||
// by calling method canBeActivated
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -288,7 +296,6 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
|||
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
|
@ -377,8 +384,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
|||
$sql .= " WHERE type = '".$db->escape($type)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
|
|
@ -464,12 +470,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
|||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name)
|
||||
{
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
$constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ $action = GETPOST('action', 'aZ09');
|
|||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'recruitmentcandidature';
|
||||
|
||||
$arrayofparameters = array(
|
||||
// 'RECRUITMENT_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
|
|
@ -131,47 +134,49 @@ if ($action == 'updateMask')
|
|||
}
|
||||
|
||||
// Activate a model
|
||||
elseif ($action == 'set')
|
||||
{
|
||||
elseif ($action == 'set') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
} elseif ($action == 'del')
|
||||
{
|
||||
} elseif ($action == 'del') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($ret > 0) {
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
elseif ($action == 'setdoc')
|
||||
{
|
||||
elseif ($action == 'setmod') {
|
||||
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity))
|
||||
{
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
elseif ($action == 'setdoc') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->$constforval = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
// We disable/enable the document template (into llx_document_model table)
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
} elseif ($action == 'setmod')
|
||||
{
|
||||
// TODO Check if numbering module chosen can be activated
|
||||
// by calling method canBeActivated
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -465,11 +470,12 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
|||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name)
|
||||
{
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -982,7 +982,7 @@ class RecruitmentCandidature extends CommonObject
|
|||
|
||||
$modelpath = "core/modules/recruitment/doc/";
|
||||
|
||||
if ($includedocgeneration) {
|
||||
if ($includedocgeneration && !empty($modele)) {
|
||||
$result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1059,8 +1059,7 @@ class RecruitmentJobPosition extends CommonObject
|
|||
$langs->load("recruitment");
|
||||
|
||||
if (!dol_strlen($modele)) {
|
||||
if (!empty($conf->global->RECRUITMENTJOBPOSITION_ADDON_PDF))
|
||||
{
|
||||
if (!empty($conf->global->RECRUITMENTJOBPOSITION_ADDON_PDF)) {
|
||||
$modele = $conf->global->RECRUITMENTJOBPOSITION_ADDON_PDF;
|
||||
} else {
|
||||
$modele = ''; // No default value. For job position, we allow to disable all PDF generation
|
||||
|
|
@ -1069,7 +1068,7 @@ class RecruitmentJobPosition extends CommonObject
|
|||
|
||||
$modelpath = "core/modules/recruitment/doc/";
|
||||
|
||||
if ($includedocgeneration) {
|
||||
if ($includedocgeneration && !empty($modele)) {
|
||||
$result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
|
|||
$texte .= '</td>';
|
||||
|
||||
$texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
|
||||
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
|
||||
$texte .= '<span class="opacitymedium">'.$langs->trans("ExampleOfDirectoriesForModelGen").'</span>';
|
||||
$texte .= '</td>';
|
||||
$texte .= '</tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
|
||||
|
||||
// Show Draft Watermark
|
||||
if ($object->statut == Facture::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK)))
|
||||
if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK)))
|
||||
{
|
||||
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
|
||||
}
|
||||
|
|
@ -885,7 +885,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
|
|||
$pdf->SetXY($posx, $posy);
|
||||
$pdf->SetTextColor(0, 0, 60);
|
||||
$textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref);
|
||||
if ($object->statut == Facture::STATUS_DRAFT)
|
||||
if ($object->statut == $object::STATUS_DRAFT)
|
||||
{
|
||||
$pdf->SetTextColor(128, 0, 0);
|
||||
$textref .= ' - '.$outputlangs->transnoentities("NotValidated");
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
$login=checkLoginPassEntity('admin', 'admin', 1, array('dolibarr')); // Should works because admin/admin exists
|
||||
print __METHOD__." login=".$login."\n";
|
||||
$this->assertEquals($login, 'admin');
|
||||
$this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed');
|
||||
|
||||
$login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authetntication method
|
||||
print __METHOD__." login=".$login."\n";
|
||||
|
|
@ -553,4 +553,27 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolSanitizeFileName
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDolSanitizeFileName()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
//$dummyuser=new User($db);
|
||||
//$result=restrictedArea($dummyuser,'societe');
|
||||
|
||||
$result=dol_sanitizeFileName('bad file | evilaction');
|
||||
$this->assertEquals('bad file _ evilaction', $result);
|
||||
|
||||
$result=dol_sanitizeFileName('bad file --evilparam');
|
||||
$this->assertEquals('bad file _evilparam', $result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user