Merge pull request #8 from Dolibarr/develop

pull from develop
This commit is contained in:
Tobias Sekan 2020-03-10 08:50:02 +01:00 committed by GitHub
commit 3569406563
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 48 additions and 29 deletions

View File

@ -65,7 +65,7 @@ class Proposals extends DolibarrApi
*/ */
public function get($id, $contact_list = 1) public function get($id, $contact_list = 1)
{ {
return $this->_fetch($id, '', '', '', $contact_list); return $this->_fetch($id, '', '', $contact_list);
} }
/** /**
@ -83,7 +83,7 @@ class Proposals extends DolibarrApi
*/ */
public function getByRef($ref, $contact_list = 1) public function getByRef($ref, $contact_list = 1)
{ {
return $this->_fetch('', $ref, '', '', $contact_list); return $this->_fetch('', $ref, '', $contact_list);
} }
/** /**
@ -101,7 +101,7 @@ class Proposals extends DolibarrApi
*/ */
public function getByRefExt($ref_ext, $contact_list = 1) public function getByRefExt($ref_ext, $contact_list = 1)
{ {
return $this->_fetch('', '', $ref_ext, '', $contact_list); return $this->_fetch('', '', $ref_ext, $contact_list);
} }
/** /**

View File

@ -64,7 +64,7 @@ class Orders extends DolibarrApi
*/ */
public function get($id, $contact_list = 1) public function get($id, $contact_list = 1)
{ {
return $this->_fetch($id, '', '', '', $contact_list); return $this->_fetch($id, '', '', $contact_list);
} }
/** /**
@ -82,7 +82,7 @@ class Orders extends DolibarrApi
*/ */
public function getByRef($ref, $contact_list = 1) public function getByRef($ref, $contact_list = 1)
{ {
return $this->_fetch('', $ref, '', '', $contact_list); return $this->_fetch('', $ref, '', $contact_list);
} }
/** /**
@ -100,7 +100,7 @@ class Orders extends DolibarrApi
*/ */
public function getByRefExt($ref_ext, $contact_list = 1) public function getByRefExt($ref_ext, $contact_list = 1)
{ {
return $this->_fetch('', '', $ref_ext, '', $contact_list); return $this->_fetch('', '', $ref_ext, $contact_list);
} }
/** /**

View File

@ -306,7 +306,7 @@ if (empty($reshook))
if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
$array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht; $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht;
$array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_subprice; $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_total_ht;
} }
//var_dump($array_of_total_ht_per_vat_rate);exit; //var_dump($array_of_total_ht_per_vat_rate);exit;

View File

@ -64,7 +64,7 @@ class Invoices extends DolibarrApi
*/ */
public function get($id, $contact_list = 1) public function get($id, $contact_list = 1)
{ {
return $this->_fetch($id, '', '', '', $contact_list); return $this->_fetch($id, '', '', $contact_list);
} }
/** /**
@ -82,7 +82,7 @@ class Invoices extends DolibarrApi
*/ */
public function getByRef($ref, $contact_list = 1) public function getByRef($ref, $contact_list = 1)
{ {
return $this->_fetch('', $ref, '', '', $contact_list); return $this->_fetch('', $ref, '', $contact_list);
} }
/** /**
@ -100,7 +100,7 @@ class Invoices extends DolibarrApi
*/ */
public function getByRefExt($ref_ext, $contact_list = 1) public function getByRefExt($ref_ext, $contact_list = 1)
{ {
return $this->_fetch('', '', $ref_ext, '', $contact_list); return $this->_fetch('', '', $ref_ext, $contact_list);
} }
/** /**

View File

@ -965,9 +965,13 @@ class DolGraph
$legends = array(); $legends = array();
$nblot = 0; $nblot = 0;
if (is_array($this->data) && is_array($this->data[0])) { if (is_array($this->data)) {
$nblot = count($this->data[0]) - 1; // -1 to remove legend foreach ($this->data as $valarray) // Loop on each x
{
$nblot = max($nblot, count($valarray) - 1); // -1 to remove legend
}
} }
//var_dump($nblot);
if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING); if ($nblot < 0) dol_syslog('Bad value for property ->data. Must be set by mydolgraph->SetData before calling mydolgrapgh->draw', LOG_WARNING);
$firstlot = 0; $firstlot = 0;
// Works with line but not with bars // Works with line but not with bars
@ -1000,17 +1004,20 @@ class DolGraph
); );
} else { } 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); $values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
} }
$x++; $x++;
} }
//var_dump($values);
$j = 0; $j = 0;
foreach ($values as $x => $y) { foreach ($values as $x => $y) {
if (isset($y)) { if (isset($y)) {
$serie[$i] .= ($j > 0 ? ", " : "").$y; $serie[$i] .= ($j > 0 ? ", " : "").$y;
$j++; } else {
$serie[$i] .= ($j > 0 ? ", " : "").'null';
} }
$j++;
} }
$values = null; // Free mem $values = null; // Free mem
@ -1207,19 +1214,20 @@ class DolGraph
$oldstacknum = -1; $oldstacknum = -1;
while ($i < $nblot) // Loop on each serie while ($i < $nblot) // Loop on each serie
{ {
$usecolorvariantforgroupby=0;
// We used a 'group by' and we have too many colors so we generated color variants per // 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. if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
$nbofcolorneeds = count($arrayofgroupslegend); $nbofcolorneeds = count($arrayofgroupslegend);
$nbofcolorsavailable = count($theme_datacolor); $nbofcolorsavailable = count($theme_datacolor);
if ($nbofcolorneeds > $nbofcolorsavailable) { if ($nbofcolorneeds > $nbofcolorsavailable) {
$usecolorvariantforgroypby = 1; $usecolorvariantforgroupby = 1;
} }
$textoflegend = $arrayofgroupslegend[$i]['legendwithgroup']; $textoflegend = $arrayofgroupslegend[$i]['legendwithgroup'];
} else { } else {
$textoflegend = $this->Legend[$i]; $textoflegend = $this->Legend[$i];
} }
if ($usecolorvariantforgroypby) { if ($usecolorvariantforgroupby) {
$newcolor = $this->datacolor[$arrayofgroupslegend[$i]['stacknum']]; $newcolor = $this->datacolor[$arrayofgroupslegend[$i]['stacknum']];
// If we change the stack // If we change the stack
if ($oldstacknum == -1 || $arrayofgroupslegend[$i]['stacknum'] != $oldstacknum) { if ($oldstacknum == -1 || $arrayofgroupslegend[$i]['stacknum'] != $oldstacknum) {
@ -1245,7 +1253,6 @@ class DolGraph
$color = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].', 0.9)'; $color = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].', 0.9)';
$bordercolor = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].')'; $bordercolor = 'rgb('.$newcolor[0].', '.$newcolor[1].', '.$newcolor[2].')';
} else { // We do not use a 'group by' } else { // We do not use a 'group by'
$color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)'; $color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].', 0.9)';
$bordercolor = $color; $bordercolor = $color;

View File

@ -202,7 +202,7 @@ class Form
$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">'; $ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
if (empty($notabletag)) $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">'; if (empty($notabletag)) $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
if (empty($notabletag)) $ret .= '<tr><td>'; if (empty($notabletag)) $ret .= '<tr><td>';
if (preg_match('/^(string|email)/', $typeofdata)) if (preg_match('/^(string|safehtmlstring|email)/', $typeofdata))
{ {
$tmp = explode(':', $typeofdata); $tmp = explode(':', $typeofdata);
$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>'; $ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').'>';
@ -276,6 +276,7 @@ class Form
if (preg_match('/^(email)/', $typeofdata)) $ret .= dol_print_email($value, 0, 0, 0, 0, 1); if (preg_match('/^(email)/', $typeofdata)) $ret .= dol_print_email($value, 0, 0, 0, 0, 1);
elseif (preg_match('/^(amount|numeric)/', $typeofdata)) $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : ''); elseif (preg_match('/^(amount|numeric)/', $typeofdata)) $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) $ret .= dol_htmlentitiesbr($value); elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) $ret .= dol_htmlentitiesbr($value);
elseif (preg_match('/^safehtmlstring/', $typeofdata)) $ret .= dol_string_onlythesehtmltags($value);
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret .= dol_print_date($value, 'day'); elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret .= dol_print_date($value, 'day');
elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') $ret .= dol_print_date($value, 'dayhour'); elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') $ret .= dol_print_date($value, 'dayhour');
elseif (preg_match('/^select;/', $typeofdata)) elseif (preg_match('/^select;/', $typeofdata))

View File

@ -1348,7 +1348,8 @@ class FormOther
* @param array $arrayofgroupby Array of groupby to fill * @param array $arrayofgroupby Array of groupby to fill
* @return string HTML string component * @return string HTML string component
*/ */
public function selectGroupByField($object, $search_groupby, &$arrayofgroupby) { public function selectGroupByField($object, $search_groupby, &$arrayofgroupby)
{
global $langs, $extrafields, $form; global $langs, $extrafields, $form;
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1); $YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
@ -1404,7 +1405,8 @@ class FormOther
* @param array $arrayofxaxis Array of groupby to fill * @param array $arrayofxaxis Array of groupby to fill
* @return string HTML string component * @return string HTML string component
*/ */
public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis) { public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis)
{
global $langs, $extrafields, $form; global $langs, $extrafields, $form;
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1); $YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);

View File

@ -163,7 +163,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
$content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content); $content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Replace relative link '/' with dolibarr URL // Replace relative link '/' with dolibarr URL
$content = preg_replace('/(href=")\/\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep); $content = preg_replace('/(href=")\/(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'\2"', $content, -1, $nbrep);
// Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL (we discard param ?...) // Replace relative link /xxx.php#aaa or /xxx.php with dolibarr URL (we discard param ?...)
$content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep); $content = preg_replace('/(href=")\/?([^:\"\!]*)\.php(#[^\"<>]*)?\"/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2\3"', $content, -1, $nbrep);
// Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL // Replace relative link /xxx.php?a=b&c=d#aaa or /xxx.php?a=b&c=d with dolibarr URL

View File

@ -1372,7 +1372,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->comptabilite->enabled)) if (!empty($conf->comptabilite->enabled))
{ {
// Files // Files
if ((!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) || !empty($conf->global->ACCOUNTANCY_SHOW_EXPORT_FILES_MENU)) if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU))
{ {
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&amp;leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&amp;leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files');
} }

View File

@ -1967,7 +1967,7 @@ elseif ($id || $ref)
// Tracking Number // Tracking Number
print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber", 'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber", 'tracking_number', $object->tracking_number, $object, $user->rights->expedition->creer).'</td><td colspan="3">';
print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'string', $object->tracking_number); print $form->editfieldval("TrackingNumber", 'tracking_number', $object->tracking_url, $object, $user->rights->expedition->creer, 'safehtmlstring', $object->tracking_number);
print '</td></tr>'; print '</td></tr>';
// Incoterms // Incoterms

View File

@ -1064,9 +1064,11 @@ if ($action == 'create')
} }
else else
{ {
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
dol_fiche_head(''); dol_fiche_head('');
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
if (is_object($objectsrc)) if (is_object($objectsrc))
{ {
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">'; print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';

View File

@ -665,9 +665,9 @@ if ($action == 'charge' && !empty($conf->stripe->enabled))
if ($paymentintent->status != 'succeeded') if ($paymentintent->status != 'succeeded')
{ {
$error++; $error++;
$errormessage = "StatusOfRetreivedIntent is not succeeded: ".$e->getMessage(); $errormessage = "StatusOfRetreivedIntent is not succeeded: ".$paymentintent->status;
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
setEventMessages($e->getMessage(), null, 'errors'); setEventMessages($paymentintent->status, null, 'errors');
$action = ''; $action = '';
} }
else else

View File

@ -1002,7 +1002,7 @@ class Website extends CommonObject
fputs($fp, $line); fputs($fp, $line);
// Warning: We must keep llx_ here. It is a generic SQL. // Warning: We must keep llx_ here. It is a generic SQL.
$line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, otherlang, image, keywords, status, date_creation, tms, import_key, grabbed_from, type_container, htmlheader, content)'; $line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, image, keywords, status, date_creation, tms, import_key, grabbed_from, type_container, htmlheader, content)';
$line .= " VALUES("; $line .= " VALUES(";
$line .= $objectpageold->newid."__+MAX_llx_website_page__, "; $line .= $objectpageold->newid."__+MAX_llx_website_page__, ";
@ -1013,7 +1013,6 @@ class Website extends CommonObject
$line .= "'".$this->db->escape($objectpageold->title)."', "; $line .= "'".$this->db->escape($objectpageold->title)."', ";
$line .= "'".$this->db->escape($objectpageold->description)."', "; $line .= "'".$this->db->escape($objectpageold->description)."', ";
$line .= "'".$this->db->escape($objectpageold->lang)."', "; $line .= "'".$this->db->escape($objectpageold->lang)."', ";
$line .= "'".$this->db->escape($objectpageold->otherlang)."', ";
$line .= "'".$this->db->escape($objectpageold->image)."', "; $line .= "'".$this->db->escape($objectpageold->image)."', ";
$line .= "'".$this->db->escape($objectpageold->keywords)."', "; $line .= "'".$this->db->escape($objectpageold->keywords)."', ";
$line .= "'".$this->db->escape($objectpageold->status)."', "; $line .= "'".$this->db->escape($objectpageold->status)."', ";

View File

@ -849,6 +849,13 @@ if ($action == 'addcontainer')
{ {
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else {
$filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php';
// Generate the index.php page to be the home page
$result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper);
if ($result <= 0) setEventMessages('Failed to write file '.$fileindex, null, 'errors');
} }
} }
} }
@ -1327,8 +1334,9 @@ if ($action == 'setashome')
{ {
$db->commit(); $db->commit();
$filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php';
// Generate the index.php page to be the home page // Generate the index.php page to be the home page
//-------------------------------------------------
$result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper); $result = dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper);
if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs'); if ($result) setEventMessages($langs->trans("Saved"), null, 'mesgs');