diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 35829b5dcbf..c47321dbf7c 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1725,10 +1725,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib('', 1).''; + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index dd9d58eb7d3..130f5580e3a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -520,7 +520,7 @@ class Adherent extends CommonObject * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) - * @param int $addbadge Add badge (1=Full label, 2=First letter only) + * @param int $addbadge Add badge (1=Full label, 2=First letters only) * @return string Label */ public function getmorphylib($morphy = '', $addbadge = 0) @@ -534,21 +534,27 @@ class Adherent extends CommonObject if ($addbadge) { $s = ''; + $labeltoshowm = $langs->trans("Moral"); + $labeltoshowp = $langs->trans("Physical"); if ($morphy == 'phy') { + $labeltoshow = $labeltoshowp; if ($addbadge == 2) { - $labeltoshow = dol_substr($langs->trans("Physical"), 0, 1); - } else { - $labeltoshow = $langs->trans("Physical"); + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp)); + if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowm))) { + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp, 2)); + } } - $s .= ''.$labeltoshow.''; + $s .= ''.$labeltoshow.''; } if ($morphy == 'mor') { + $labeltoshow = $labeltoshowm; if ($addbadge == 2) { - $labeltoshow = dol_substr($langs->trans("Moral"), 0, 1); - } else { - $labeltoshow = $langs->trans("Moral"); + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm)); + if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowp))) { + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm, 2)); + } } - $s .= ''.$labeltoshow.''; + $s .= ''.$labeltoshow.''; } } else { if ($morphy == 'phy') { diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index bce8227ab57..37d6e72a97e 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -158,13 +158,12 @@ if ($id > 0) { } // Type - print ''.$langs->trans("Type").''.$membert->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$membert->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; - /*print ''; - print $form->showphoto('memberphoto',$object); - print '';*/ + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index ea5e22fe153..938ab368ae1 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -133,13 +133,12 @@ if ($id) { } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; - /*print ''; - print $form->showphoto('memberphoto',$member); - print '';*/ + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index db40a8ad465..cc5b600b2a4 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -506,10 +506,12 @@ if ($rowid > 0) { } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c3eede90efd..cb7e1a8883e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -641,6 +641,12 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask return 0; } + $srcexists = dol_is_file($srcfile); + if (!$srcexists) { + dol_syslog("files.lib.php::dolReplaceInFile failed to read src file", LOG_WARNING); + return -3; + } + $tmpdestfile = $destfile.'.tmp'; $newpathofsrcfile = dol_osencode($srcfile); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 09c9d3e9943..6d2841a08b2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3830,6 +3830,26 @@ function isValidPhone($phone) } +/** + * Return first letters of a strings. + * Example with nbofchar=1: 'ghi' will return 'g' but 'abc def' will return 'ad' + * Example with nbofchar=2: 'ghi' will return 'gh' but 'abc def' will return 'abde' + * + * @param string $s String to truncate + * @param int $nbofchar Nb of characters to keep + * @return string Return first chars. + */ +function dolGetFirstLetters($s, $nbofchar = 1) { + $ret = ''; + $tmparray = explode(' ', $s); + foreach($tmparray as $tmps) { + $ret .= dol_substr($tmps, 0, $nbofchar); + } + + return $ret; +} + + /** * Make a strlen call. Works even if mbstring module not enabled * diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 29f1a229054..daa3ff1da21 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -295,7 +295,20 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { margin: 2px; border-radius: 3px; } - +.member-company-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} +.member-individual-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} .bg-infobox-project{ diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index daf3c409397..e2733acc2bc 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -48,7 +48,20 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { margin: 2px; border-radius: 3px; } - +.member-company-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} +.member-individual-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} .bg-infobox-project{ color: #6c6aa8 !important; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index a8a85423da3..d532f7f475c 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1003,10 +1003,14 @@ class Website extends CommonObject // Make some replacement into some files $cssindestdir = $conf->website->dir_temp.'/'.$website->ref.'/containers/styles.css.php'; - dolReplaceInFile($cssindestdir, $arrayreplacementincss); + if (dol_is_file($cssindestdir)) { + dolReplaceInFile($cssindestdir, $arrayreplacementincss); + } $htmldeaderindestdir = $conf->website->dir_temp.'/'.$website->ref.'/containers/htmlheader.html'; - dolReplaceInFile($htmldeaderindestdir, $arrayreplacementincss); + if (dol_is_file($htmldeaderindestdir)) { + dolReplaceInFile($htmldeaderindestdir, $arrayreplacementincss); + } // Build sql file $filesql = $conf->website->dir_temp.'/'.$website->ref.'/website_pages.sql';