diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f4645721185..9fb99f69173 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -916,6 +916,7 @@ abstract class CommonObject
// TODO uniformize field name
$fieldname = 'fk_mode_reglement';
if ($this->element == 'societe') $fieldname = 'mode_reglement';
+ if (get_class($this) == 'Fournisseur') $fieldname = 'mode_reglement_supplier';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;
@@ -955,6 +956,7 @@ abstract class CommonObject
// TODO uniformize field name
$fieldname = 'fk_cond_reglement';
if ($this->element == 'societe') $fieldname = 'cond_reglement';
+ if (get_class($this) == 'Fournisseur') $fieldname = 'cond_reglement_supplier';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = '.$id;
diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php
index d61d49476bc..f813d720569 100644
--- a/htdocs/fourn/fiche.php
+++ b/htdocs/fourn/fiche.php
@@ -63,7 +63,20 @@ if ($action == 'setsupplieraccountancycode')
}
$action="";
}
-
+// conditions de reglement
+if ($action == 'setconditions' && $user->rights->societe->creer)
+{
+ $object->fetch($id);
+ $result=$object->setPaymentTerms(GETPOST('cond_reglement_supplier_id','int'));
+ if ($result < 0) dol_print_error($db,$object->error);
+}
+// mode de reglement
+if ($action == 'setmode' && $user->rights->societe->creer)
+{
+ $object->fetch($id);
+ $result=$object->setPaymentMethods(GETPOST('mode_reglement_supplier_id','int'));
+ if ($result < 0) dol_print_error($db,$object->error);
+}
/*
@@ -90,7 +103,7 @@ if ($object->fetch($id))
//print '
';
print '';
- print '| '.$langs->trans("ThirdPartyName").' | ';
+ print ' | | '.$langs->trans("ThirdPartyName").' | ';
$object->next_prev_filter="te.fournisseur = 1";
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print ' | ';
@@ -193,6 +206,46 @@ if ($object->fetch($id))
print '| '.$langs->trans('VATIntra').' | ';
print $object->tva_intra;
print ' | ';
+
+ // Conditions de reglement par defaut
+ $langs->load('bills');
+ $form = new Form($db);
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editconditions')
+ {
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_supplier_id,'cond_reglement_supplier_id',-1,1);
+ }
+ else
+ {
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_supplier_id,'none');
+ }
+ print " | ";
+ print ' ';
+
+ // Mode de reglement par defaut
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editmode')
+ {
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'mode_reglement_supplier_id');
+ }
+ else
+ {
+ $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_supplier_id,'none');
+ }
+ print " | ";
+ print ' ';
// Module Adherent
if (! empty($conf->adherent->enabled))
diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
index f13042bff2e..27663a23faf 100755
--- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
+++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql
@@ -280,3 +280,7 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
ALTER TABLE llx_bordereau_cheque ADD ref_ext VARCHAR(255);
ALTER TABLE llx_bordereau_cheque ADD tms timestamp;
+
+-- Task 1011
+ALTER TABLE `llx_societe` ADD `mode_reglement_supplier` TINYINT NOT NULL AFTER `cond_reglement` ,
+ADD `cond_reglement_supplier` TINYINT NOT NULL AFTER `mode_reglement_supplier`;
\ No newline at end of file
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index 95ceadec503..9348ab3b6d5 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -77,6 +77,8 @@ create table llx_societe
remise_client real DEFAULT 0, -- remise systematique pour le client
mode_reglement tinyint, -- mode de reglement
cond_reglement tinyint, -- condition de reglement
+ mode_reglement_supplier tinyint, -- mode de reglement fournisseur
+ cond_reglement_supplier tinyint, -- condition de reglement fournisseur
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
localtax2_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 2
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 6278b7bd8ab..60e4a1461ad 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -106,6 +106,8 @@ class Societe extends CommonObject
var $remise_percent;
var $mode_reglement_id;
var $cond_reglement_id;
+ var $mode_reglement_supplier_id;
+ var $cond_reglement_supplier_id;
var $client; // 0=no customer, 1=customer, 2=prospect, 3=customer and prospect
var $prospect; // 0=no prospect, 1=prospect
@@ -707,7 +709,7 @@ class Societe extends CommonObject
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
- $sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
+ $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang, s.logo';
$sql .= ', s.import_key, s.canvas';
$sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif';
@@ -826,6 +828,8 @@ class Societe extends CommonObject
$this->remise_percent = $obj->remise_client;
$this->mode_reglement_id = $obj->mode_reglement;
$this->cond_reglement_id = $obj->cond_reglement;
+ $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier;
+ $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier;
$this->client = $obj->client;
$this->fournisseur = $obj->fournisseur;
|