diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 7ce92a5b569..c2183a2b6e1 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1982,7 +1982,7 @@ if ($action == 'create') {
print '
| ';
print $langs->trans('BankAccount');
print ' | ';
- if (($action != 'editbankaccount') && $user->rights->propal->creer && ! empty($object->brouillon))
+ if ($action != 'editbankaccount' && $user->rights->propal->creer)
print ' | id.'">'.img_edit($langs->trans('SetBankAccount'),1).' | ';
print '
';
print '';
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 19948e3c1b7..7bf3705c07d 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -2138,7 +2138,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '| ';
print $langs->trans('BankAccount');
print ' | ';
- if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
+ if ($action != 'editbankaccount' && $user->rights->commande->creer)
print ' | id.'">'.img_edit($langs->trans('SetBankAccount'),1).' | ';
print ' ';
print ' | ';
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index b65fe31ceec..19432c09b78 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -74,6 +74,7 @@ class CommandeFournisseur extends CommonOrder
var $fk_project;
var $cond_reglement_id;
var $cond_reglement_code;
+ var $fk_account;
var $mode_reglement_id;
var $mode_reglement_code;
var $user_author_id;
@@ -126,6 +127,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= " c.date_creation, c.date_valid, c.date_approve,";
$sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve,";
$sql.= " c.date_commande as date_commande, c.date_livraison as date_livraison, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_input_method,";
+ $sql.= " c.fk_account,";
$sql.= " c.note_private, c.note_public, c.model_pdf, c.extraparams,";
$sql.= " cm.libelle as methode_commande,";
$sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,";
@@ -180,6 +182,7 @@ class CommandeFournisseur extends CommonOrder
$this->cond_reglement_code = $obj->cond_reglement_code;
$this->cond_reglement = $obj->cond_reglement_libelle;
$this->cond_reglement_doc = $obj->cond_reglement_libelle;
+ $this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;
$this->mode_reglement = $obj->mode_reglement_libelle;
@@ -876,6 +879,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= ", model_pdf";
$sql.= ", fk_mode_reglement";
$sql.= ", fk_cond_reglement";
+ $sql.= ", fk_account";
$sql.= ") ";
$sql.= " VALUES (";
$sql.= "''";
@@ -892,6 +896,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= ", '".$conf->global->COMMANDE_SUPPLIER_ADDON_PDF."'";
$sql.= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'null');
$sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'null');
+ $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
$sql.= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 05e2fe8822f..dbac3c4230d 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -125,6 +125,11 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
}
+// bank account
+else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) {
+ $result=$object->setBankAccount(GETPOST('fk_account', 'int'));
+ }
+
// date de livraison
if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer)
{
@@ -776,6 +781,7 @@ else if ($action == 'add' && $user->rights->fournisseur->commande->creer)
$object->socid = $socid;
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
+ $object->fk_account = GETPOST('fk_account', 'int');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
@@ -1116,6 +1122,11 @@ if ($action=="create")
$form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
print ' | ';
+ // Bank Account
+ print '| ' . $langs->trans('BankAccount') . ' | ';
+ $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
+ print ' |
';
+
print '| '.$langs->trans('NotePublic').' | ';
print '';
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
@@ -1381,6 +1392,23 @@ elseif (! empty($object->id))
}
print ' |
';
+ // Bank Account
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editbankaccount') {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
+ } else {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
+ }
+ print ' | ';
+ print '
';
+
// Delivery date planed
print '| ';
print ' |