diff --git a/ChangeLog b/ChangeLog
index 0b6a4a5b871..fb67d07ec43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,8 +13,9 @@ make a Dolibarr upgrade.
WARNING: Following changes may create regression for some external modules, but were necessary to make
Dolibarr better:
-- Deprecated hidden option MAIN_USE_CUSTOM_TRANSLATION has been removed. Use MAIN_OVERWRITE_TRANS_xx_YY instead.
-
+- Deprecated hidden option MAIN_USE_CUSTOM_TRANSLATION has been removed. Use table llx_overwrite_trans instead.
+- Trigger LINECONTRACT_INSERT has been renamed into LINECONTRACT_CREATE to match common denomination.
+
***** ChangeLog for 3.8 compared to 3.7.* *****
For users:
diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/asterisk/cidlookup.php
index ef4eaefe9c2..e50a1a74a1b 100644
--- a/htdocs/asterisk/cidlookup.php
+++ b/htdocs/asterisk/cidlookup.php
@@ -73,5 +73,9 @@ else
dol_print_error($db,'Error');
$found = 'Error';
}
+//Greek to Latin
+$greek = array('α','β','γ','δ','ε','ζ','η','θ','ι','κ','λ','μ','ν','ξ','ο','π','ρ','ς','σ','τ','υ','φ','χ','ψ','ω','Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ','Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ','Φ','Χ','Ψ','Ω','ά','έ','ή','ί','ό','ύ','ώ','ϊ','ΐ','Ά','Έ','Ή','Ί','Ό','Ύ','Ώ','Ϊ');
-echo $found;
+$latin = array('a','b','g','d','e','z','h','th','i','k','l','m','n','ks','o','p','r','s','s','t','u','f','ch','ps','w','A','B','G','D','E','Z','H','TH','I','K','L','M','N','KS','O','P','R','S','T','U','F','CH','PS','W','a','e','h','i','o','u','w','i','i','A','E','H','I','O','U','W','I');
+
+print str_replace($greek, $latin, $found);
diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index deed3b1b97a..9a04a431ac6 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -952,7 +952,7 @@ if ($id > 0 || ! empty($ref))
if ($sep > 0) print ' '; // If we had at least one line in future
else print $langs->trans("CurrentBalance");
print ' '.$object->currency_code.'';
- print '
';
+
dol_fiche_end();
}
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 6fa4e5c46a8..76a868a7888 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -1332,7 +1332,7 @@ class Contrat extends CommonObject
if (empty($error)) {
// Call trigger
- $result=$this->call_trigger('LINECONTRACT_CREATE',$user);
+ $result=$this->call_trigger('LINECONTRACT_INSERT',$user);
if ($result < 0)
{
$this->db->rollback();
@@ -2644,7 +2644,7 @@ class ContratLigne extends CommonObjectLine
if (!$notrigger)
{
// Call trigger
- $result = $this->call_trigger('LINECONTRACT_CREATE', $user);
+ $result = $this->call_trigger('LINECONTRACT_INSERT', $user);
if ($result < 0) {
$this->db->rollback();
return -1;
diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php
index 67458fd401d..a4e83a0fd59 100644
--- a/htdocs/core/actions_sendmails.inc.php
+++ b/htdocs/core/actions_sendmails.inc.php
@@ -56,7 +56,7 @@ if (! empty($_POST['removedfile']) && empty($_POST['removAll']))
$upload_dir_tmp = $vardir.'/temp';
// TODO Delete only files that was uploaded from email form
- dol_remove_file_process($_POST['removedfile'],0);
+ dol_remove_file_process(GETPOST('removedfile','alpha'),0);
$action='presend';
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 76fd73a324d..419df05a679 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -437,53 +437,82 @@ abstract class CommonObject
/**
* Return full address of contact
*
- * @param Societe $object Object Societe or null
+ * @param string $htmlkey HTML id to make banner content unique
+ * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member)
* @return string Full address string
*/
- function getBannerAddress($htmlkey, $object=null)
+ function getBannerAddress($htmlkey, $object)
{
global $conf, $langs;
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
- $out='';
+ $contacti=0;
+ $thirdpartyid=0;
+ if ($this->elemet == 'societe')
+ {
+ $thirdpartyid=$this->id;
+ }
+ if ($this->elemet == 'contact')
+ {
+ $contactid=$this->id;
+ $thirdpartyid=$object->fk_soc;
+ }
+ if ($this->elemet == 'user')
+ {
+ $contactid=$this->contact_id;
+ $thirdpartyid=$object->fk_soc;
+ }
- $out.='';
+ $out='';
$outdone=0;
$coords = $this->getFullAddress(1,', ');
- if (! empty($conf->use_javascript_ajax))
+ if ($coords)
{
- $namecoords = $this->getFullName($langs,1).' '.$coords;
- // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
- $out.='';
- $out.=img_picto($langs->trans("Address"), 'object_address.png');
- $out.=' ';
- }
- if ($coords) {
+ if (! empty($conf->use_javascript_ajax))
+ {
+ $namecoords = $this->getFullName($langs,1).' '.$coords;
+ // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile
+ $out.='';
+ $out.=img_picto($langs->trans("Address"), 'object_address.png');
+ $out.=' ';
+ }
$out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1); $outdone++;
$outdone++;
}
- if (! in_array($object->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)
+ if (! in_array($this->country_code,$countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)
&& ! empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state)
{
$out.=($outdone?' ':'').$this->state;
$outdone++;
}
-
- if ($this->phone_pro || $this->phone_mobile || $this->phone_perso || $this->fax) $out.=($outdone?' ':'');
- if ($this->phone_pro) {
- $out.=dol_print_phone($this->phone_pro,$country_code['code'],$this->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++;
+
+ if ($this->phone_pro || $this->phone_mobile || $this->phone_perso || $this->fax || $this->office_phone || $this->user_mobile || $this->office_fax) $out.=($outdone?' ':'');
+ if ($this->phone && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
+ $out.=dol_print_phone($this->phone,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhonePro")); $outdone++;
}
- if ($this->phone_mobile) {
- $out.=dol_print_phone($this->phone_mobile,$country_code['code'],$this->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++;
+ if (! empty($this->phone_pro)) {
+ $out.=dol_print_phone($this->phone_pro,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhonePro")); $outdone++;
}
- if ($this->phone_perso) {
- $out.=dol_print_phone($this->phone_perso,$country_code['code'],$this->rowid,$object->id,'AC_TEL',' ','phone'); $outdone++;
+ if (! empty($this->phone_mobile)) {
+ $out.=dol_print_phone($this->phone_mobile,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhoneMobile")); $outdone++;
}
- if ($this->fax) {
- $out.=dol_print_phone($this->fax,$country_code['code'],$this->rowid,$object->id,'AC_FAX',' ','fax'); $outdone++;
+ if (! empty($this->phone_perso)) {
+ $out.=dol_print_phone($this->phone_perso,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhonePerso")); $outdone++;
+ }
+ if (! empty($this->fax)) {
+ $out.=dol_print_phone($this->fax,$country_code['code'],$contactid,$thirdpartyid,'AC_FAX',' ','fax',$langs->trans("Fax")); $outdone++;
+ }
+ if (! empty($this->office_phone)) {
+ $out.=dol_print_phone($this->office_phone,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhonePro")); $outdone++;
+ }
+ if (! empty($this->user_mobile)) {
+ $out.=dol_print_phone($this->user_mobile,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhoneMobile")); $outdone++;
+ }
+ if (! empty($this->office_fax)) {
+ $out.=dol_print_phone($this->fax,$country_code['code'],$contactid,$thirdpartyid,'AC_FAX',' ','fax',$langs->trans("Fax")); $outdone++;
}
$out.='';
@@ -503,7 +532,7 @@ abstract class CommonObject
if ($this->skype) $out.=($outdone?' ':'').dol_print_skype($this->skype,$this->id,$object->id,'AC_SKYPE');
}
- $out.='';
+ $out.='';
return $out;
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 4aea23291c2..17771a56782 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5152,7 +5152,16 @@ class Form
$ret.='
';
- $ret.=dol_htmlentities($object->$fieldref);
+ // For thirdparty and contact, the ref is he id, so we show something else
+ if ($object->element == 'societe')
+ {
+ $ret.=dol_htmlentities($object->name);
+ }
+ else if (in_array($object->element, array('contact', 'user', 'member')))
+ {
+ $ret.=dol_htmlentities($object->getFullName($langs));
+ }
+ else $ret.=dol_htmlentities($object->$fieldref);
if ($morehtmlref)
{
$ret.=' '.$morehtmlref;
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index d7fbaedfeba..565078a9d3b 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -706,7 +706,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$contactstatic->web = $obj->web;
$contactstatic->skype = $obj->skype;
- $country_code = getCountry($obj->country_id, 'all');
+ $country_code = getCountry($obj->country_id, 2);
$contactstatic->country_code = $country_code;
print "
";
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 2f49b37f716..aa804cf1255 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1516,7 +1516,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
* @param int $donotdeletefile 1=Do not delete physically file
* @return void
*/
-function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=0)
+function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=1)
{
global $db,$user,$conf,$langs,$_FILES;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 7f4a1b8d855..4a39269c23e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -840,6 +840,58 @@ function dol_get_fiche_end($notab=0)
else return '';
}
+/**
+ * Show tab footer of a card
+ *
+ * @param object $object Object to show
+ * @param string $paramid Name of parameter to use to name the id into the URL link
+ * @param string $morehtml More html content to output just before the nav bar
+ * @param int $shownav Show Condition (navigation is shown if value is 1)
+ * @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
+ * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
+ * @param string $morehtmlref More html to show after ref
+ * @param string $moreparam More param to add in nav link url.
+ * @param int $nodbprefix Do not include DB prefix to forge table name
+ * @param string $morehtmlleft More html code to show before ref
+ * @param string $morehtmlright More html code to show before navigation arrows
+ * @return void
+ */
+function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlright='')
+{
+ global $conf, $form, $user, $langs;
+
+ //$showlogo=$object->logo;
+ $showlogo=1;
+ $showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
+ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
+ $modulepart='societe';
+ if ($object->element == 'contact') $modulepart='contact';
+ if ($object->element == 'member') $modulepart='memberphoto';
+ if ($object->element == 'user') $modulepart='userphoto';
+
+ print '
';
+ print '';
+}
+
/**
* Show a string with the label tag dedicated to the HTML edit field.
*
@@ -924,8 +976,8 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
else // Other: title firstname name \n address lines \n zip town \n country
{
- $ret .= ($ret ? $sep : '' ).$object->zip;
- $ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
+ $ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';
+ $ret .= ($object->town?(($object->zip?' ':$sep).$object->town):'');
if ($object->state && in_array($object->country_code,$countriesusingstate))
{
$ret.=($ret?", ":'').$object->state;
@@ -1440,12 +1492,13 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
* @param string $country Country code to use for formatting
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
- * @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set)
+ * @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set)
* @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @param string $withpicto Show picto
+ * @param string $titlealt Text to show on alt
* @return string Formated phone number
*/
-function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" ",$withpicto='')
+function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ=" ",$withpicto='',$titlealt='')
{
global $conf,$user,$langs,$mysoc;
@@ -1525,7 +1578,11 @@ function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ="
}
}
- return '