diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d045c5f0ea7..90fdc246be6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1660,23 +1660,86 @@ if ($action == 'create') // Print form confirm print $formconfirm; - print '
| ' . $langs->trans('Ref') . ' | '; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print ' | ||||
';
print '
| |||||
| '.$langs->trans('Ref').' | '; + print ' | ||
| '.$langs->trans('Ref').' | '; print $form->showrefnav($object,'ref',$linkback,1,'ref','ref',''); print ' | ||
| '.$langs->trans("BankName").' | '; + print '|||
| '.$langs->trans("BankName").' | '; print ''.$account->bank.' | ||
| '.$langs->trans("AccountancyCode").' | '; + print '|||
| '.$langs->trans("AccountancyCode").' | '; print ''; if (! empty($conf->accounting->enabled)) { print length_accountg($account->account_number).' | ||
| '.$langs->trans("BankName").' | '; + print '|||
| '.$langs->trans("BankName").' | '; print ''; print ' | ||
| '.$langs->trans("AccountancyCode").' | '; + print '|||
| '.$langs->trans("AccountancyCode").' | '; print '';
if (!empty($conf->accounting->enabled)) {
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 4e4f027ae12..8f1e40db48f 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -433,7 +433,7 @@ abstract class CommonObject
/**
- * Return full address of contact
+ * Return full address for banner
*
* @param string $htmlkey HTML id to make banner content unique
* @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member)
@@ -476,7 +476,7 @@ abstract class CommonObject
$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++;
+ $out.=dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++;
$outdone++;
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 0369bd76789..c8ae8dd8b6b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3540,30 +3540,33 @@ class Form
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely except $selected,2=Disable)
* @param int $maxlength Max length
* @param int $forcefocus Force focus on field (works with javascript only)
- * @return void
+ * @param int $nooutput No print is done. String is returned.
+ * @return string Return html content
*/
- function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0)
+ function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0)
{
global $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+ $out='';
+
$formproject=new FormProjets($this->db);
$langs->load("project");
if ($htmlname != "none")
{
- print "\n";
- print '';
+ $out.="\n";
+ $out.='';
}
else
{
@@ -3572,13 +3575,20 @@ class Form
$projet = new Project($this->db);
$projet->fetch($selected);
//print ''.$projet->title.'';
- print $projet->getNomUrl(0,'',1);
+ $out.=$projet->getNomUrl(0,'',1);
}
else
{
- print " ";
+ $out.=" ";
}
}
+
+ if (empty($nooutput))
+ {
+ print $out;
+ return '';
+ }
+ return $out;
}
/**
@@ -5738,7 +5748,7 @@ class Form
}
}
- else dol_print_error('','Call of showphoto with wrong parameters');
+ else dol_print_error('','Call of showphoto with wrong parameters modulepart='.$modulepart);
return $ret;
}
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 4c4c1486d51..f1ec7edae73 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -48,7 +48,7 @@ class FormProjets
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id project preselected
- * @param string $htmlname Nom de la zone html
+ * @param string $htmlname Name of HTML field
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
@@ -57,12 +57,15 @@ class FormProjets
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode
* @param string $filterkey Key to filter
- * @return int Nber of project if OK, <0 if KO
+ * @param int $nooutput No print output. Return it only.
+ * @return string Return html content
*/
- function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '')
+ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '', $nooutput=0)
{
global $langs,$conf,$form;
+ $out='';
+
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT))
{
$placeholder='';
@@ -75,26 +78,33 @@ class FormProjets
$selected_input_value=$project->ref;
}
$urloption='socid='.$socid.'&htmlname='.$htmlname;
- print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
+ $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
// 'update' => array(
// 'projectid' => 'id'
// )
));
- print '';
+ $out.='';
}
else
{
- print $this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey);
+ $out.=$this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey, 1);
if ($discard_closed)
{
if (class_exists('Form'))
{
if (empty($form)) $form=new Form($this->db);
- print $form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden"));
+ $out.=$form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden"));
}
}
}
+
+ if (empty($nooutput))
+ {
+ print $out;
+ return '';
+ }
+ else return $out;
}
/**
@@ -111,9 +121,10 @@ class FormProjets
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example)
* @param string $filterkey Key to filter
+ * @param int $nooutput No print output. Return it only.
* @return int Nb of project if OK, <0 if KO
*/
- function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '')
+ function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '', $nooutput=0)
{
global $user,$conf,$langs;
@@ -250,10 +261,13 @@ class FormProjets
$this->db->free($resql);
if (!$mode) {
- if (empty($option_only)) {
- $out.= '';
+ if (empty($option_only)) $out.= '';
+ if (empty($nooutput))
+ {
+ print $out;
+ return '';
}
- print $out;
+ else return $out;
} else {
return $outarray;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 88423aac279..8159c0b86a5 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -920,8 +920,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$modulepart='unknown';
if ($object->element == 'societe') $modulepart='societe';
if ($object->element == 'contact') $modulepart='contact';
- if ($object->element == 'member') $modulepart='memberphoto';
- if ($object->element == 'user') $modulepart='userphoto';
+ if ($object->element == 'member') $modulepart='memberphoto';
+ if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
print ' ';
@@ -947,7 +947,18 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
}
else
{
- if ($showimage) $morehtmlleft.=' '.$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos).' ';
+ if ($showimage)
+ {
+ $morehtmlleft.='';
+ if ($modulepart != 'unknown') $morehtmlleft.=$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos);
+ else
+ {
+ $width=14; $cssclass='photorefcenter';
+ $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1);
+ $morehtmlleft.=' ';
+ }
}
if ($showbarcode) $morehtmlleft.=''.$form->showbarcode($object).' ';
if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
@@ -970,7 +981,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
}
}
else {
- $morehtmlright.=$object->getLibStatut(5);
+ $tmptxt=$object->getLibStatut(6);
+ if (empty($tmptxt)) $tmptxt=$object->getLibStatut(5);
+ $morehtmlright.=$tmptxt;
}
if (! empty($object->name_alias)) $morehtmlref.=''.$object->name_alias.' '; // For thirdparty
if (! empty($object->label)) $morehtmlref.=''.$object->label.' '; // For product
@@ -1793,10 +1806,11 @@ function dol_user_country()
* @param int $mode thirdparty|contact|member|other
* @param int $id Id of object
* @param int $noprint No output. Result is the function return
+ * @param string $charfornl Char to use instead of nl2br. '' means we use a standad nl2br.
* @return string|void Nothing if noprint is 0, formatted address if noprint is 1
* @see dol_format_address
*/
-function dol_print_address($address, $htmlid, $mode, $id, $noprint=0)
+function dol_print_address($address, $htmlid, $mode, $id, $noprint=0, $charfornl='')
{
global $conf, $user, $langs, $hookmanager;
@@ -1811,7 +1825,9 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0)
}
if (empty($reshook))
{
- $out.=nl2br($address);
+ if (empty($charfornl)) $out.=nl2br($address);
+ else $out.=preg_replace('/[\r\n]+/', $charfornl, $address);
+
$showgmap=$showomap=0;
// TODO Add a hook here
diff --git a/htdocs/product/note.php b/htdocs/product/note.php
index b3f2fa1c01c..9a914527a83 100644
--- a/htdocs/product/note.php
+++ b/htdocs/product/note.php
@@ -93,23 +93,20 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'note', $titre, 0, $picto);
-
- print ' | ||