Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
Browse files Browse the repository at this point in the history
develop_dict

Conflicts:
	htdocs/install/mysql/migration/5.0.0-6.0.0.sql
  • Loading branch information
hregis committed Jul 21, 2017
2 parents c8bd116 + f97ecd0 commit 26df138
Show file tree
Hide file tree
Showing 43 changed files with 704 additions and 338 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Expand Up @@ -2,6 +2,11 @@
English Dolibarr ChangeLog
--------------------------------------------------------------


***** ChangeLog for 7.0.0 compared to 6.0.* *****



***** ChangeLog for 6.0.0 compared to 5.0.* *****

For developers:
Expand Down
5 changes: 4 additions & 1 deletion dev/resources/iso-normes/world_tax_rates.txt
@@ -1 +1,4 @@
http://www.taxrates.cc/index.html
http://www.taxrates.cc/index.html

For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst

2 changes: 1 addition & 1 deletion htdocs/admin/multicurrency.php
Expand Up @@ -100,7 +100,7 @@
if ($submit == $langs->trans('Modify'))
{
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
$rate = GETPOST('rate', 'float');
$rate = price2num(GETPOST('rate', 'alpha'));
$currency = new MultiCurrency($db);

if ($currency->fetch($fk_multicurrency) > 0)
Expand Down
65 changes: 57 additions & 8 deletions htdocs/admin/websites.php
Expand Up @@ -73,23 +73,23 @@

// Requests to extract data
$tabsql=array();
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";

// Criteria to sort dictionaries
$tabsqlsort=array();
$tabsqlsort[1] ="ref ASC";

// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[1] = "ref,description";
$tabfield[1] = "ref,description,virtualhost";

// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[1] = "ref,description";
$tabfieldvalue[1] = "ref,description,virtualhost";

// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[1] = "ref,description,entity";
$tabfieldinsert[1] = "ref,description,virtualhost,entity";

// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
Expand All @@ -103,7 +103,7 @@

// List of help for fields
$tabhelp=array();
$tabhelp[1] = array();
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));

// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
Expand All @@ -114,7 +114,7 @@
$elementList = array();
$sourceList=array();

// Actions add or modify an entry into a dictionary
// Actions add or modify a website
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
{
$listfield=explode(',',$tabfield[$id]);
Expand All @@ -126,14 +126,27 @@
$ok=1;
foreach ($listfield as $f => $value)
{
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
if ((! isset($_POST[$value]) || $_POST[$value]=='')
&& (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory
{
$ok=0;
$fieldnamekey=$listfield[$f];
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
if ($value == 'ref' && ! preg_match('/^[a-z0-9]+$/i', $_POST[$value]))
{
$ok=0;
$fieldnamekey=$listfield[$f];
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}

// Clean parameters
if (! empty($_POST['ref']))
{
$websitekey=strtolower($_POST['ref']);
}

// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd','alpha'))
{
Expand All @@ -153,6 +166,12 @@
}
}

/* $website=new Website($db);
$website->ref=
$website->description=
$website->virtualhost=
$website->create($user); */

// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
Expand All @@ -171,6 +190,9 @@
if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($value == 'ref') {
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
}
if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
Expand All @@ -182,6 +204,29 @@
$result = $db->query($sql);
if ($result) // Add is ok
{
global $dolibarr_main_data_root;
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
$filecss=$pathofwebsite.'/styles.css.php';
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
$fileindex=$pathofwebsite.'/index.php';

// Css file
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THE FILE styles.css.php. Change affects all pages of website. -->'."\n";
$csscontent.= '<?php '."\n";
$csscontent.= "header('Content-type: text/css');\n";
$csscontent.= "?>"."\n";
$csscontent.= '<!-- END -->'."\n";
$csscontent.= 'body { margin: 0; }'."\n";

dol_syslog("Save file css into ".$filecss);

dol_mkdir($pathofwebsite);
$result = file_put_contents($filecss, $csscontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filecss, octdec($conf->global->MAIN_UMASK));

setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
unset($_POST); // Clean $_POST array, we keep only
}
Expand Down Expand Up @@ -393,7 +438,11 @@
{
print '<td class="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
elseif (! empty($tabhelp[$id][$value]))
{
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
}
else print $valuetoshow;
print '</td>';
}
Expand Down
1 change: 1 addition & 0 deletions htdocs/comm/propal/list.php
Expand Up @@ -355,6 +355,7 @@
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
if (empty($search_societe)) $search_societe = $soc->name;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions htdocs/commande/list.php
Expand Up @@ -578,6 +578,7 @@
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
if (empty($search_company)) $search_company = $soc->name;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions htdocs/compta/facture/list.php
Expand Up @@ -531,6 +531,7 @@
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_societe)) $search_societe = $soc->name;
}

$param='&socid='.$socid;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/contrat/class/contrat.class.php
Expand Up @@ -1633,8 +1633,8 @@ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $dat
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
$contractline->array_options=$array_option;
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
$contractline->array_options=$array_options;
$contractline->id= $rowid;
$result=$contractline->insertExtraFields();
if ($result < 0)
{
Expand Down
9 changes: 8 additions & 1 deletion htdocs/contrat/list.php
Expand Up @@ -305,8 +305,15 @@
$i = 0;

$arrayofselected=is_array($toselect)?$toselect:array();

if ($socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_name)) $search_name = $soc->name;
}

$param='';
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall != '') $param.='&sall='.$sall;
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/actions_sendmails.inc.php
Expand Up @@ -391,6 +391,9 @@
$object->trackid = $trackid;
$object->fk_element = $object->id;
$object->elementtype = $object->element;
if (is_array($attachedfiles) && count($attachedfiles)>0) {
$object->attachedfiles = $attachedfiles;
}

// Call of triggers
if (! empty($trigger_name))
Expand Down
31 changes: 17 additions & 14 deletions htdocs/core/class/doleditor.class.php
Expand Up @@ -52,7 +52,7 @@ class DolEditor
* @param string $content Content of WYSIWIG field
* @param int $width Width in pixel of edit area (auto by default)
* @param int $height Height in pixel of edit area (200px by default)
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly')
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly', 'ace').
* @param string $toolbarlocation Where bar is stored :
* 'In' each window has its own toolbar
* 'Out:name' share toolbar into the div called 'name'
Expand Down Expand Up @@ -145,9 +145,10 @@ function __construct($htmlname,$content,$width='',$height=200,$toolbarname='Basi
* @param string $morejs Add more js. For example: ".on( \'saveSnapshot\', function(e) { alert(\'ee\'); });". Used by CKEditor only.
* @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only.
* @param string $titlecontent Show title content before editor area. Used by ACE editor only.
* @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...)
* @return void|string
*/
function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='')
function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='')
{
global $conf,$langs;

Expand Down Expand Up @@ -254,21 +255,21 @@ function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent=
if (preg_match('/^ace/', $this->tool))
{
$found=1;
$format=(GETPOST('format','aZ09')?GETPOST('format','aZ09'):'php');
$format=$option;

$out.= '<!-- Output Ace editor -->'."\n";
$out.= "\n".'<!-- Output Ace editor -->'."\n";

if ($titlecontent)
{
$out.= '<div class="aceeditorstatusbar" id="statusBar">'.$titlecontent;
$out.= ' &nbsp; - &nbsp; <a id="morelines" href="#" class="right morelines">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> &nbsp; &nbsp; ';
$out.= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
$out.= ' &nbsp; - &nbsp; <a id="morelines" href="#" class="right morelines'.$this->htmlname.'">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> &nbsp; &nbsp; ';
$out.= '</div>';
$out.= '<script type="text/javascript" language="javascript">'."\n";
$out.= 'jQuery(document).ready(function() {'."\n";
$out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar")); // Init status bar. Need lib ext-statusbar
jQuery("#morelines").click(function() {
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar
jQuery(".morelines'.$this->htmlname.'").click(function() {
console.log("We click on more lines");
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
aceEditor.setOptions({ maxLines: 500 });
Expand Down Expand Up @@ -297,8 +298,8 @@ function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent=
enableLiveAutocompletion: false, // the editor completes the statement while you are typing. Need lib ext-language_tools.js
showPrintMargin: false, // hides the vertical limiting strip
minLines: 10,
maxLines: 34,
fontSize: "110%" // ensures that the editor fits in the environment
maxLines: '.(empty($this->height)?'34':(round($this->height/10))).',
fontSize: "110%" // ensures that the editor fits in the environment
});
// defines the style of the editor
Expand All @@ -311,10 +312,12 @@ function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent=

$out.= 'jQuery(document).ready(function() {
jQuery("#savefile").click(function() {
console.log("We click on savefile button");
console.log("We click on savefile button for component '.$this->htmlname.'");
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
console.log(aceEditor.getSession().getValue());
jQuery("#'.$this->htmlname.'").val(aceEditor.getSession().getValue());
if (strlen(jQuery("#'.$this->htmlname.'").html()) > 0) return true;
else return false;
/*if (jQuery("#'.$this->htmlname.'").html().length > 0) return true;
else return false;*/
});
})';
$out.= '</script>'."\n";
Expand Down
8 changes: 8 additions & 0 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -5606,6 +5606,14 @@ function showLinkToObjectBlock($object, $restrictlinksto=array(), $excludelinkst
{
$listofidcompanytoscan=$object->thirdparty->id;
if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent;
if (($object->fk_project > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO))
{
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$tmpproject=new Project($this->db);
$tmpproject->fetch($object->fk_project);
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) $listofidcompanytoscan.=','.$tmpproject->socid;
unset($tmpproject);
}

$possiblelinks=array(
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
Expand Down

0 comments on commit 26df138

Please sign in to comment.