diff --git a/html/js/nicEdit.js b/html/js/nicEdit.js
index a4af59f60..bc4a278a6 100644
--- a/html/js/nicEdit.js
+++ b/html/js/nicEdit.js
@@ -1198,26 +1198,35 @@ var nicLinkButton = nicEditorAdvancedButton.extend({
'target' : {type : 'select', txt : 'Open In', options : {'' : 'Current Window', '_blank' : 'New Window'},style : {width : '100px'}}
},this.ln);
},
-
- submit : function(e) {
+
+ submit: function(e) {
var url = this.inputs['href'].value;
- if(url == "http://" || url == "") {
+ if (url === "http://" || url === "") {
alert("You must enter a URL to Create a Link");
return false;
}
this.removePane();
-
- if(!this.ln) {
+
+ if (!this.ln) {
var tmp = 'javascript:nicTemp();';
- this.ne.nicCommand("createlink",tmp);
- this.ln = this.findElm('A','href',tmp);
+ this.ne.nicCommand("createlink", tmp);
+ this.ln = this.findElm('A', 'href', tmp);
+ // set the link text to the title or the url if there is no text selected
+ if (this.ln.innerHTML == tmp) {
+ this.ln.innerHTML = this.inputs['title'].value || url;
+ }
}
- if(this.ln) {
+ if (this.ln) {
+ var oldTitle = this.ln.title;
this.ln.setAttributes({
- href : this.inputs['href'].value,
- title : this.inputs['title'].value,
- target : this.inputs['target'].options[this.inputs['target'].selectedIndex].value
+ href: this.inputs['href'].value,
+ title: this.inputs['title'].value,
+ target: this.inputs['target'].options[this.inputs['target'].selectedIndex].value
});
+ // set the link text to the title or the url if the old text was the old title
+ if (this.ln.innerHTML == oldTitle) {
+ this.ln.innerHTML = this.inputs['title'].value || this.inputs['href'].value;
+ }
}
}
});
diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php
index b715c242b..0c1424f24 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -1260,7 +1260,7 @@ class Acc_Ledger extends jrn_def_sql
{
$f=new Fiche($this->db);
$f->quick_code=${'qc_'.$i};
- if ($f->belong_ledger($p_jrn)<0)
+ if ($f->belong_ledger($p_jrn) < 1 )
throw new Exception("La fiche quick_code = ".
$f->quick_code." n'est pas dans ce journal", 4);
if (noalyss_strlentrim(${'qc_'.$i})!=0&&isNumber(${'amount'.$i})==0)
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index fd1028383..c40f010cb 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -1507,8 +1507,7 @@ class Fiche
if ( $p_type == 'deb' )
{
$get='jrn_def_fiche_deb';
- }
- if ( $p_type == 'cred' )
+ }elseif ( $p_type == 'cred' )
{
$get='jrn_def_fiche_cred';
}