diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 2d8887c7929..66191110de2 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1646,7 +1646,7 @@ if ($action == 'create') {
// Terms of payment
print '
| '.$langs->trans('PaymentConditionsShort').' | ';
print img_picto('', 'paiment');
- $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1);
+ $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
print ' |
';
// Mode of payment
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 94bea1e56b4..534679554c2 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4862,7 +4862,7 @@ abstract class CommonObject
*/
public function printOriginLinesList($restrictlist = '', $selectedLines = array())
{
- global $langs, $hookmanager, $conf, $form;
+ global $langs, $hookmanager, $conf, $form, $action;
print '';
print '| '.$langs->trans('Ref').' | ';
@@ -4888,7 +4888,7 @@ abstract class CommonObject
if (is_object($hookmanager)) { // Old code is commented on preceding line.
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
if (!empty($line->fk_parent_line)) { $parameters['fk_parent_line'] = $line->fk_parent_line; }
- $reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+ $reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
if (empty($reshook)) {
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);
diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php
index 6f2ec2acfb6..1778b46995e 100644
--- a/htdocs/core/class/html.formsetup.class.php
+++ b/htdocs/core/class/html.formsetup.class.php
@@ -44,6 +44,41 @@ class FormSetup
/** @var int */
protected $maxItemRank;
+ /**
+ * this is an html string display before output form
+ * @var string
+ */
+ public $htmlBeforeOutputForm = '';
+
+ /**
+ * this is an html string display after output form
+ * @var string
+ */
+ public $htmlAfterOutputForm = '';
+
+ /**
+ * this is an html string display on buttons zone
+ * @var string
+ */
+ public $htmlOutputMoreButton = '';
+
+
+ /**
+ *
+ * @var array
+ */
+ public $formAttributes = array(
+ 'action' => '', // set in __construct
+ 'method' => 'POST'
+ );
+
+ /**
+ * an list of hidden inputs used only in edit mode
+ * @var array
+ */
+ public $formHiddenInputs = array();
+
+
/**
* Constructor
*
@@ -55,6 +90,11 @@ class FormSetup
global $langs;
$this->db = $db;
$this->form = new Form($this->db);
+ $this->formAttributes['action'] = $_SERVER["PHP_SELF"];
+
+ $this->formHiddenInputs['token'] = newToken();
+ $this->formHiddenInputs['action'] = 'update';
+
if ($outputLangs) {
$this->langs = $outputLangs;
@@ -63,6 +103,27 @@ class FormSetup
}
}
+ /**
+ * Generate an attributes string form an input array
+ * @param array $attributes an array of attributes keys and values,
+ * @return string
+ */
+ static public function generateAttributesStringFromArray($attributes)
+ {
+ $Aattr = array();
+ if (is_array($attributes)) {
+ foreach ($attributes as $attribute => $value) {
+ if (is_array($value) || is_object($value)) {
+ continue;
+ }
+ $Aattr[] = $attribute.'="'.dol_escape_htmltag($value).'"';
+ }
+ }
+
+ return !empty($Aattr)?implode(' ', $Aattr):'';
+ }
+
+
/**
* @param bool $editMode true will display output on edit mod
* @return string
@@ -83,12 +144,70 @@ class FormSetup
if ($reshook > 0) {
return $hookmanager->resPrint;
} else {
- $out = '';
+ $out = '';
+ $out.= $this->htmlBeforeOutputForm;
+
if ($editMode) {
- $out .= '';
+ $out.= '